-
Notifications
You must be signed in to change notification settings - Fork 897
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
How-to block: improve a11y and manage focus when adding total time #10766
Comments
Spent some time on this to understand why focus management didn't work at all any longer. To my understanding, In the 3.9.0 deprecations, it was noted:
😞 |
Also the |
For the initial focus on the blocks, I think it should be addressed upstream. Created WordPress/gutenberg#12648 |
For history: To see how focus management worked originally, test with Gutenberg 3.7.0. |
When adding total time to a How-to block, the interaction with the "Add total time" button behavior can be improved for better accessibility.
This button doesn't say anything to screen reader users about what is going to happen when pressed:
In similar cases, an
aria-expanded
attribute could help users understand that the button makes something appear in the page. However, since this button disappears when activated, I'd rather consider to just manage focus and move it to the hour input field. The field will be properly announced when it receives focus once it will be properly labelled, see #10750Worth noting that currently, as soon as the "Add total time" button is pressed using the keyboard, there's a focus loss. We should always, always, avoid to remove from the DOM an element that's currently focused. If removing it is really, really, necessary, then focus must be managed programmatically.
Please consider the focus loss is more evident in some browsers (e.g. IE 11) or when using a screen reader. Modern browsers try to keep focus "in place". Regardless, at some point there's no focused element.
To make the focus loss more evident, in the screenshots below I'm using a red outline as focus indicator:
focus is on the "Add total time" button:
After activation, the button disappears and there's a focus loss:
Same happens when activating the "Delete total time" button:
After activation, the button disappears and there's a focus loss:
In this case, I'd propose to move focus back to the "Add total time" button.
The text was updated successfully, but these errors were encountered: