-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Enable accessibility features for the button example #18749
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
base: main
Are you sure you want to change the base?
Conversation
…cessibility systems will recognise it.
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.
Can we change the name of the button to avoid having it said twice? Examples are also about creating clarity.
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.
I don't have much UI or accessibility experience, but I'm clicking approve as the changes look sensible and I've tested it works with NVDA (Win 10).
… changes to hovered or pressed. The accessibility system's only update the button's state when the `Button` component is marked as changed.
…shonpe/bevy into button-example-accessibility
Yep, now the screen reader should report "hovered" when the button is hovered and "pressed" when the button is pressed. |
Objective
Accessibility features don't work with the UI
button
example becauseInputFocus
must be set for the accessibility systems to recognise the button.Fixes #18760
Solution
InputFocus
when it is hovered or pressed.set_changed
on theButton
component when the button's state changes to hovered or pressed (the accessibility system's only update the button's state when theButton
component is marked as changed).Testing
Install NVDA, it should say "hover" when the button is hovered and "pressed" when the button is pressed.
The bounds of the accessibility node are reported incorrectly. I thought we fixed this, I'll take another look at it. It's not a problem with this PR.