-
Notifications
You must be signed in to change notification settings - Fork 6k
[web:a11y] fix traversal and hit-test orders #32712
Changes from 1 commit
3b7f799
a63bdd7
2052773
52076d3
0ff84fc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -290,9 +290,20 @@ class FlutterViewEmbedder { | |
| .prepareAccessibilityPlaceholder(); | ||
|
|
||
| glassPaneElementHostNode.nodes.addAll(<html.Node>[ | ||
| semanticsHostElement, | ||
| _accessibilityPlaceholder, | ||
| _sceneHostElement!, | ||
|
|
||
| // The semantic host goes last because hit-test order-wise we want it to | ||
| // be first. If semantics goes under the scene host, platform views will | ||
| // obscure semantic elements. | ||
| // | ||
| // You may be wondering: wouldn't semantics obscure platform views and | ||
| // make then not accessible? At least with some careful planning, that | ||
| // should not be the case. The semantics tree makes all of its non-leaf | ||
| // elements transparent. This way, if a platform view appears among other | ||
| // interactive Flutter widgets, as long as those widgets do not intersect | ||
| // with the platform view, the platform view will be reachable. | ||
| semanticsHostElement, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is there a test coverage for this?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In the past I could find a way to write a test that would emulate browser's hit test. But I just found this: https://developer.mozilla.org/en-US/docs/web/api/document/elementsfrompoint. I'm going to try.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| ]); | ||
|
|
||
| // When debugging semantics, make the scene semi-transparent so that the | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Now that the accessibility tree renders on top of the scene host, this is probably not required anymore :P
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good point. Strictly speaking, no. But reducing the transparency of the scene makes the semantics overlay more visible, making it easier to work with. I'll keep the transparency, but I will update the comment. |
||
|
|
@@ -304,11 +315,6 @@ class FlutterViewEmbedder { | |
| PointerBinding.initInstance(glassPaneElement); | ||
| KeyboardBinding.initInstance(glassPaneElement); | ||
|
|
||
| // Hide the DOM nodes used to render the scene from accessibility, because | ||
| // the accessibility tree is built from the SemanticsNode tree as a parallel | ||
| // DOM tree. | ||
| _sceneHostElement!.setAttribute('aria-hidden', 'true'); | ||
|
|
||
| if (html.window.visualViewport == null && isWebKit) { | ||
| // Older Safari versions sometimes give us bogus innerWidth/innerHeight | ||
| // values when the page loads. When it changes the values to correct ones | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: avoid we
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here and everywhere,
wemay refer to different entity based on the reader's perspective.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.