Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
04d3ecb8
Unverified
Commit
04d3ecb8
authored
Feb 10, 2018
by
Michael Goderbauer
Committed by
GitHub
Feb 10, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add accessibilityFocus and loseAccessibilityFocus as a11y actions (#14603)
parent
72517f0a
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
174 additions
and
2 deletions
+174
-2
engine.version
bin/internal/engine.version
+1
-1
proxy_box.dart
packages/flutter/lib/src/rendering/proxy_box.dart
+74
-0
semantics.dart
packages/flutter/lib/src/semantics/semantics.dart
+88
-0
basic.dart
packages/flutter/lib/src/widgets/basic.dart
+9
-1
semantics_test.dart
packages/flutter/test/widgets/semantics_test.dart
+2
-0
No files found.
bin/internal/engine.version
View file @
04d3ecb8
8ac6f6efa177fb548dcdc81f1501f060b2ad1115
a00f94582b61dec88a140751a8a43d79d525fd8f
packages/flutter/lib/src/rendering/proxy_box.dart
View file @
04d3ecb8
...
@@ -3022,6 +3022,8 @@ class RenderSemanticsAnnotations extends RenderProxyBox {
...
@@ -3022,6 +3022,8 @@ class RenderSemanticsAnnotations extends RenderProxyBox {
MoveCursorHandler
onMoveCursorForwardByCharacter
,
MoveCursorHandler
onMoveCursorForwardByCharacter
,
MoveCursorHandler
onMoveCursorBackwardByCharacter
,
MoveCursorHandler
onMoveCursorBackwardByCharacter
,
SetSelectionHandler
onSetSelection
,
SetSelectionHandler
onSetSelection
,
VoidCallback
onDidGainAccessibilityFocus
,
VoidCallback
onDidLoseAccessibilityFocus
,
})
:
assert
(
container
!=
null
),
})
:
assert
(
container
!=
null
),
_container
=
container
,
_container
=
container
,
_explicitChildNodes
=
explicitChildNodes
,
_explicitChildNodes
=
explicitChildNodes
,
...
@@ -3050,6 +3052,8 @@ class RenderSemanticsAnnotations extends RenderProxyBox {
...
@@ -3050,6 +3052,8 @@ class RenderSemanticsAnnotations extends RenderProxyBox {
_onMoveCursorForwardByCharacter
=
onMoveCursorForwardByCharacter
,
_onMoveCursorForwardByCharacter
=
onMoveCursorForwardByCharacter
,
_onMoveCursorBackwardByCharacter
=
onMoveCursorBackwardByCharacter
,
_onMoveCursorBackwardByCharacter
=
onMoveCursorBackwardByCharacter
,
_onSetSelection
=
onSetSelection
,
_onSetSelection
=
onSetSelection
,
_onDidGainAccessibilityFocus
=
onDidGainAccessibilityFocus
,
_onDidLoseAccessibilityFocus
=
onDidLoseAccessibilityFocus
,
super
(
child
);
super
(
child
);
/// If 'container' is true, this [RenderObject] will introduce a new
/// If 'container' is true, this [RenderObject] will introduce a new
...
@@ -3493,6 +3497,62 @@ class RenderSemanticsAnnotations extends RenderProxyBox {
...
@@ -3493,6 +3497,62 @@ class RenderSemanticsAnnotations extends RenderProxyBox {
markNeedsSemanticsUpdate
();
markNeedsSemanticsUpdate
();
}
}
/// The handler for [SemanticsAction.didGainAccessibilityFocus].
///
/// This handler is invoked when the node annotated with this handler gains
/// the accessibility focus. The accessibility focus is the
/// green (on Android with TalkBack) or black (on iOS with VoiceOver)
/// rectangle shown on screen to indicate what element an accessibility
/// user is currently interacting with.
///
/// The accessibility focus is different from the input focus. The input focus
/// is usually held by the element that currently responds to keyboard inputs.
/// Accessibility focus and input focus can be held by two different nodes!
///
/// See also:
///
/// * [onDidLoseAccessibilityFocus], which is invoked when the accessibility
/// focus is removed from the node
/// * [FocusNode], [FocusScope], [FocusManager], which manage the input focus
VoidCallback
get
onDidGainAccessibilityFocus
=>
_onDidGainAccessibilityFocus
;
VoidCallback
_onDidGainAccessibilityFocus
;
set
onDidGainAccessibilityFocus
(
VoidCallback
handler
)
{
if
(
_onDidGainAccessibilityFocus
==
handler
)
return
;
final
bool
hadValue
=
_onDidGainAccessibilityFocus
!=
null
;
_onDidGainAccessibilityFocus
=
handler
;
if
((
handler
!=
null
)
!=
hadValue
)
markNeedsSemanticsUpdate
();
}
/// The handler for [SemanticsAction.didLoseAccessibilityFocus].
///
/// This handler is invoked when the node annotated with this handler
/// loses the accessibility focus. The accessibility focus is
/// the green (on Android with TalkBack) or black (on iOS with VoiceOver)
/// rectangle shown on screen to indicate what element an accessibility
/// user is currently interacting with.
///
/// The accessibility focus is different from the input focus. The input focus
/// is usually held by the element that currently responds to keyboard inputs.
/// Accessibility focus and input focus can be held by two different nodes!
///
/// See also:
///
/// * [onDidGainAccessibilityFocus], which is invoked when the node gains
/// accessibility focus
/// * [FocusNode], [FocusScope], [FocusManager], which manage the input focus
VoidCallback
get
onDidLoseAccessibilityFocus
=>
_onDidLoseAccessibilityFocus
;
VoidCallback
_onDidLoseAccessibilityFocus
;
set
onDidLoseAccessibilityFocus
(
VoidCallback
handler
)
{
if
(
_onDidLoseAccessibilityFocus
==
handler
)
return
;
final
bool
hadValue
=
_onDidLoseAccessibilityFocus
!=
null
;
_onDidLoseAccessibilityFocus
=
handler
;
if
((
handler
!=
null
)
!=
hadValue
)
markNeedsSemanticsUpdate
();
}
@override
@override
void
describeSemanticsConfiguration
(
SemanticsConfiguration
config
)
{
void
describeSemanticsConfiguration
(
SemanticsConfiguration
config
)
{
super
.
describeSemanticsConfiguration
(
config
);
super
.
describeSemanticsConfiguration
(
config
);
...
@@ -3552,6 +3612,10 @@ class RenderSemanticsAnnotations extends RenderProxyBox {
...
@@ -3552,6 +3612,10 @@ class RenderSemanticsAnnotations extends RenderProxyBox {
config
.
onMoveCursorBackwardByCharacter
=
_performMoveCursorBackwardByCharacter
;
config
.
onMoveCursorBackwardByCharacter
=
_performMoveCursorBackwardByCharacter
;
if
(
onSetSelection
!=
null
)
if
(
onSetSelection
!=
null
)
config
.
onSetSelection
=
_performSetSelection
;
config
.
onSetSelection
=
_performSetSelection
;
if
(
onDidGainAccessibilityFocus
!=
null
)
config
.
onDidGainAccessibilityFocus
=
_performDidGainAccessibilityFocus
;
if
(
onDidLoseAccessibilityFocus
!=
null
)
config
.
onDidLoseAccessibilityFocus
=
_performDidLoseAccessibilityFocus
;
}
}
void
_performTap
()
{
void
_performTap
()
{
...
@@ -3623,6 +3687,16 @@ class RenderSemanticsAnnotations extends RenderProxyBox {
...
@@ -3623,6 +3687,16 @@ class RenderSemanticsAnnotations extends RenderProxyBox {
if
(
onSetSelection
!=
null
)
if
(
onSetSelection
!=
null
)
onSetSelection
(
selection
);
onSetSelection
(
selection
);
}
}
void
_performDidGainAccessibilityFocus
()
{
if
(
onDidGainAccessibilityFocus
!=
null
)
onDidGainAccessibilityFocus
();
}
void
_performDidLoseAccessibilityFocus
()
{
if
(
onDidLoseAccessibilityFocus
!=
null
)
onDidLoseAccessibilityFocus
();
}
}
}
/// Causes the semantics of all earlier render objects below the same semantic
/// Causes the semantics of all earlier render objects below the same semantic
...
...
packages/flutter/lib/src/semantics/semantics.dart
View file @
04d3ecb8
...
@@ -329,6 +329,8 @@ class SemanticsProperties extends DiagnosticableTree {
...
@@ -329,6 +329,8 @@ class SemanticsProperties extends DiagnosticableTree {
this
.
onMoveCursorForwardByCharacter
,
this
.
onMoveCursorForwardByCharacter
,
this
.
onMoveCursorBackwardByCharacter
,
this
.
onMoveCursorBackwardByCharacter
,
this
.
onSetSelection
,
this
.
onSetSelection
,
this
.
onDidGainAccessibilityFocus
,
this
.
onDidLoseAccessibilityFocus
,
});
});
/// If non-null, indicates that this subtree represents something that can be
/// If non-null, indicates that this subtree represents something that can be
...
@@ -590,6 +592,44 @@ class SemanticsProperties extends DiagnosticableTree {
...
@@ -590,6 +592,44 @@ class SemanticsProperties extends DiagnosticableTree {
/// beginning/end" or "Select all" from the local context menu.
/// beginning/end" or "Select all" from the local context menu.
final
SetSelectionHandler
onSetSelection
;
final
SetSelectionHandler
onSetSelection
;
/// The handler for [SemanticsAction.didGainAccessibilityFocus].
///
/// This handler is invoked when the node annotated with this handler gains
/// the accessibility focus. The accessibility focus is the
/// green (on Android with TalkBack) or black (on iOS with VoiceOver)
/// rectangle shown on screen to indicate what element an accessibility
/// user is currently interacting with.
///
/// The accessibility focus is different from the input focus. The input focus
/// is usually held by the element that currently responds to keyboard inputs.
/// Accessibility focus and input focus can be held by two different nodes!
///
/// See also:
///
/// * [onDidLoseAccessibilityFocus], which is invoked when the accessibility
/// focus is removed from the node
/// * [FocusNode], [FocusScope], [FocusManager], which manage the input focus
final
VoidCallback
onDidGainAccessibilityFocus
;
/// The handler for [SemanticsAction.didLoseAccessibilityFocus].
///
/// This handler is invoked when the node annotated with this handler
/// loses the accessibility focus. The accessibility focus is
/// the green (on Android with TalkBack) or black (on iOS with VoiceOver)
/// rectangle shown on screen to indicate what element an accessibility
/// user is currently interacting with.
///
/// The accessibility focus is different from the input focus. The input focus
/// is usually held by the element that currently responds to keyboard inputs.
/// Accessibility focus and input focus can be held by two different nodes!
///
/// See also:
///
/// * [onDidGainAccessibilityFocus], which is invoked when the node gains
/// accessibility focus
/// * [FocusNode], [FocusScope], [FocusManager], which manage the input focus
final
VoidCallback
onDidLoseAccessibilityFocus
;
@override
@override
void
debugFillProperties
(
DiagnosticPropertiesBuilder
description
)
{
void
debugFillProperties
(
DiagnosticPropertiesBuilder
description
)
{
super
.
debugFillProperties
(
description
);
super
.
debugFillProperties
(
description
);
...
@@ -1977,6 +2017,54 @@ class SemanticsConfiguration {
...
@@ -1977,6 +2017,54 @@ class SemanticsConfiguration {
_onSetSelection
=
value
;
_onSetSelection
=
value
;
}
}
/// The handler for [SemanticsAction.didGainAccessibilityFocus].
///
/// This handler is invoked when the node annotated with this handler gains
/// the accessibility focus. The accessibility focus is the
/// green (on Android with TalkBack) or black (on iOS with VoiceOver)
/// rectangle shown on screen to indicate what element an accessibility
/// user is currently interacting with.
///
/// The accessibility focus is different from the input focus. The input focus
/// is usually held by the element that currently responds to keyboard inputs.
/// Accessibility focus and input focus can be held by two different nodes!
///
/// See also:
///
/// * [onDidLoseAccessibilityFocus], which is invoked when the accessibility
/// focus is removed from the node
/// * [FocusNode], [FocusScope], [FocusManager], which manage the input focus
VoidCallback
get
onDidGainAccessibilityFocus
=>
_onDidGainAccessibilityFocus
;
VoidCallback
_onDidGainAccessibilityFocus
;
set
onDidGainAccessibilityFocus
(
VoidCallback
value
)
{
_addArgumentlessAction
(
SemanticsAction
.
didGainAccessibilityFocus
,
value
);
_onDidGainAccessibilityFocus
=
value
;
}
/// The handler for [SemanticsAction.didLoseAccessibilityFocus].
///
/// This handler is invoked when the node annotated with this handler
/// loses the accessibility focus. The accessibility focus is
/// the green (on Android with TalkBack) or black (on iOS with VoiceOver)
/// rectangle shown on screen to indicate what element an accessibility
/// user is currently interacting with.
///
/// The accessibility focus is different from the input focus. The input focus
/// is usually held by the element that currently responds to keyboard inputs.
/// Accessibility focus and input focus can be held by two different nodes!
///
/// See also:
///
/// * [onDidGainAccessibilityFocus], which is invoked when the node gains
/// accessibility focus
/// * [FocusNode], [FocusScope], [FocusManager], which manage the input focus
VoidCallback
get
onDidLoseAccessibilityFocus
=>
_onDidLoseAccessibilityFocus
;
VoidCallback
_onDidLoseAccessibilityFocus
;
set
onDidLoseAccessibilityFocus
(
VoidCallback
value
)
{
_addArgumentlessAction
(
SemanticsAction
.
didLoseAccessibilityFocus
,
value
);
_onDidLoseAccessibilityFocus
=
value
;
}
/// Returns the action handler registered for [action] or null if none was
/// Returns the action handler registered for [action] or null if none was
/// registered.
/// registered.
///
///
...
...
packages/flutter/lib/src/widgets/basic.dart
View file @
04d3ecb8
...
@@ -4869,6 +4869,8 @@ class Semantics extends SingleChildRenderObjectWidget {
...
@@ -4869,6 +4869,8 @@ class Semantics extends SingleChildRenderObjectWidget {
MoveCursorHandler
onMoveCursorForwardByCharacter
,
MoveCursorHandler
onMoveCursorForwardByCharacter
,
MoveCursorHandler
onMoveCursorBackwardByCharacter
,
MoveCursorHandler
onMoveCursorBackwardByCharacter
,
SetSelectionHandler
onSetSelection
,
SetSelectionHandler
onSetSelection
,
VoidCallback
onDidGainAccessibilityFocus
,
VoidCallback
onDidLoseAccessibilityFocus
,
})
:
this
.
fromProperties
(
})
:
this
.
fromProperties
(
key:
key
,
key:
key
,
child:
child
,
child:
child
,
...
@@ -4899,6 +4901,8 @@ class Semantics extends SingleChildRenderObjectWidget {
...
@@ -4899,6 +4901,8 @@ class Semantics extends SingleChildRenderObjectWidget {
onPaste:
onPaste
,
onPaste:
onPaste
,
onMoveCursorForwardByCharacter:
onMoveCursorForwardByCharacter
,
onMoveCursorForwardByCharacter:
onMoveCursorForwardByCharacter
,
onMoveCursorBackwardByCharacter:
onMoveCursorBackwardByCharacter
,
onMoveCursorBackwardByCharacter:
onMoveCursorBackwardByCharacter
,
onDidGainAccessibilityFocus:
onDidGainAccessibilityFocus
,
onDidLoseAccessibilityFocus:
onDidLoseAccessibilityFocus
,
onSetSelection:
onSetSelection
,),
onSetSelection:
onSetSelection
,),
);
);
...
@@ -4977,6 +4981,8 @@ class Semantics extends SingleChildRenderObjectWidget {
...
@@ -4977,6 +4981,8 @@ class Semantics extends SingleChildRenderObjectWidget {
onMoveCursorForwardByCharacter:
properties
.
onMoveCursorForwardByCharacter
,
onMoveCursorForwardByCharacter:
properties
.
onMoveCursorForwardByCharacter
,
onMoveCursorBackwardByCharacter:
properties
.
onMoveCursorBackwardByCharacter
,
onMoveCursorBackwardByCharacter:
properties
.
onMoveCursorBackwardByCharacter
,
onSetSelection:
properties
.
onSetSelection
,
onSetSelection:
properties
.
onSetSelection
,
onDidGainAccessibilityFocus:
properties
.
onDidGainAccessibilityFocus
,
onDidLoseAccessibilityFocus:
properties
.
onDidLoseAccessibilityFocus
,
);
);
}
}
...
@@ -5020,7 +5026,9 @@ class Semantics extends SingleChildRenderObjectWidget {
...
@@ -5020,7 +5026,9 @@ class Semantics extends SingleChildRenderObjectWidget {
..
onPaste
=
properties
.
onPaste
..
onPaste
=
properties
.
onPaste
..
onMoveCursorForwardByCharacter
=
properties
.
onMoveCursorForwardByCharacter
..
onMoveCursorForwardByCharacter
=
properties
.
onMoveCursorForwardByCharacter
..
onMoveCursorBackwardByCharacter
=
properties
.
onMoveCursorForwardByCharacter
..
onMoveCursorBackwardByCharacter
=
properties
.
onMoveCursorForwardByCharacter
..
onSetSelection
=
properties
.
onSetSelection
;
..
onSetSelection
=
properties
.
onSetSelection
..
onDidGainAccessibilityFocus
=
properties
.
onDidGainAccessibilityFocus
..
onDidLoseAccessibilityFocus
=
properties
.
onDidLoseAccessibilityFocus
;
}
}
@override
@override
...
...
packages/flutter/test/widgets/semantics_test.dart
View file @
04d3ecb8
...
@@ -398,6 +398,8 @@ void main() {
...
@@ -398,6 +398,8 @@ void main() {
onMoveCursorForwardByCharacter:
(
bool
_
)
=>
performedActions
.
add
(
SemanticsAction
.
moveCursorForwardByCharacter
),
onMoveCursorForwardByCharacter:
(
bool
_
)
=>
performedActions
.
add
(
SemanticsAction
.
moveCursorForwardByCharacter
),
onMoveCursorBackwardByCharacter:
(
bool
_
)
=>
performedActions
.
add
(
SemanticsAction
.
moveCursorBackwardByCharacter
),
onMoveCursorBackwardByCharacter:
(
bool
_
)
=>
performedActions
.
add
(
SemanticsAction
.
moveCursorBackwardByCharacter
),
onSetSelection:
(
TextSelection
_
)
=>
performedActions
.
add
(
SemanticsAction
.
setSelection
),
onSetSelection:
(
TextSelection
_
)
=>
performedActions
.
add
(
SemanticsAction
.
setSelection
),
onDidGainAccessibilityFocus:
()
=>
performedActions
.
add
(
SemanticsAction
.
didGainAccessibilityFocus
),
onDidLoseAccessibilityFocus:
()
=>
performedActions
.
add
(
SemanticsAction
.
didLoseAccessibilityFocus
),
)
)
);
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment