-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Add a FocusSemanticEvent #126171
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a FocusSemanticEvent #126171
Conversation
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.
Maybe give some example on when this should be used and when not.
For example, this should be used if the current focus rendering object is removed and replace with another rendering object. Such design should avoid if possible. but in case this is needed, then it is a reasonable use case for this API.
Some example that is not recommended is that when a new popup or dropdown opens, moving the focus in these cases may confuse user and make it less accessible.
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.
Some example that is not recommended is that when a new popup or dropdown opens>>
#115808 For example this issue is to open a new bottom sheet and the a11y focus is not consistent. I think developers still want to change focus in such cases?
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.
For inconsistent jump, I think this something that should be fixed on our side.
chunhtai
left a comment
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.
LGTM, should probably wait for engine to be merged first.
Also have you figure out how to handle TextField?
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.
maybe
The currently focused rendering object is replaced by another rendering object. In general, such design should be avoided if possible. If not, one may want to refocus the newly added rendering object
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.
It's not clear to me what the "consistency of the accessibility focus" is. This makes it sound like you may not be able to move focus anymore after using this? Which hopefully, is not the case. What do you actually mean by consistency? Maybe, that it may break a users' expectation of how a11y focus works and therefore should be just very carefully?
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.
This makes it sound like you may not be able to move focus anymore after using this?>> No that's not the case.
It may break a users' expectation of how a11y focus works and therefore should be just very carefully? >> Yes this way to describe is more accurate.
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.
Questions I have here that probably should be answered by the doc: What if the renderObject doesn't own a semantics node? Where does focus go?
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.
sendSemanticsEvent will look up for the first parent render object with a non-null semantic node.
And it doesn't work for the textField, so I am thinking about overriding textField 's sendSemanticsEvent as a workaround, do you think it's acceptable?
And do you know some other cases like the textField?
|
Looks like some checks are failing? |
framework change:flutter/flutter#126171 issue: flutter/flutter#94523 [C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
Co-authored-by: chunhtai <[email protected]>
Co-authored-by: chunhtai <[email protected]>
Co-authored-by: chunhtai <[email protected]>
Co-authored-by: chunhtai <[email protected]>
| /// object. In general, such design should be avoided if possible. If not, one may want | ||
| /// to refocus the newly added rendering object. | ||
| /// | ||
| /// One example that are not recommended: |
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.
are->is
goderbauer
left a comment
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.
LGTM
|
The analyzer seems to be unhappy, though. |
|
ah, you saved my life, thank you for this PR |
issue: #94523
engine pr: flutter/engine#41777
Pre-launch Checklist
///).If you need help, consider asking for advice on the #hackers-new channel on Discord.