Repository navigation
[web] Fix VoiceOver child focus direction - #188820
auto-submit[bot] merged 11 commits into
Conversation
There was a problem hiding this comment.
Code Review
This pull request updates ViewFocusBinding to assign an undefined focus direction when a child element of the view root is focused, rather than the root itself. It introduces a helper method _isViewRoot to verify if the focused element is the root element, and adds several unit tests to validate this behavior. Feedback suggests simplifying the _isViewRoot implementation by replacing the mutual contains checks with a direct equality comparison (element == rootElement) to improve performance and readability.
|
An existing Git SHA, To re-trigger presubmits after closing or re-opeing a PR, or pushing a HEAD commit (i.e. with |
| return viewManager.findViewForElement(element)?.viewId; | ||
| } | ||
|
|
||
| bool _isViewRoot(int viewId, DomElement? element) { |
There was a problem hiding this comment.
If i understand correctly, this method is used to determine whether the focus is on the semantics dom or not. should probably rename to be more readable.
also what if it focuses on something else like dom from platformview or other plugins' created dom
There was a problem hiding this comment.
I think this function checks if the focus is exactly on the root element of the view. If the focus lands on any descendant, this function returns false.
| return viewManager.findViewForElement(element)?.viewId; | ||
| } | ||
|
|
||
| bool _isViewRoot(int viewId, DomElement? element) { |
There was a problem hiding this comment.
I think this function checks if the focus is exactly on the root element of the view. If the focus lands on any descendant, this function returns false.
|
autosubmit label was removed for flutter/flutter/188820, because - The status or check suite Dashboard Checks has failed. Please fix the issues identified (or deflake) before re-applying this label. |
Fixes #168458
Problem
When VoiceOver focuses a child semantics node inside a Flutter web view,
ViewFocusBindingreports it as forward tab traversal. The framework then moves focus back to the first focusable widget instead of keeping VoiceOver's target.Fix
ViewFocusBindingnow uses the keyboard direction only when the Flutter view root is focused. Child focus reportsViewFocusDirection.undefined, preserving VoiceOver's selected element.Demo
Steps: with VoiceOver on, open the rotor or context menu(CTRL+OPTION+U) and jump between form controls.
Before: focus snaps back to the first form control after each VoiceOver jump.
After: focus stays on the control VoiceOver navigated to.