-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Toolbar: consider to use a roving tabindex and standardize navigation #3383
Comments
@youknowriad ah I see, thanks! Then, going to remove the bug label, update the title, and keep this open for discussion (will also close the old issues). |
About this point:
Now that Gutenberg is using React 16, how much work would be refactoring all the toolbars in a way that they return just the buttons/controls without a wrapper and then all the buttons/controls are placed in just one wrapper? |
The main blocker would be that we apply a class to the wrapper and assign styles to elements within (including a default border): gutenberg/components/toolbar/index.js Line 28 in 3e08d83
gutenberg/components/toolbar/style.scss Lines 1 to 35 in 3e08d83
But to the point itself, yes, it is technically possible for the Toolbar component to simply return an array of the control elements. |
@aduth thanks. If I'm not wrong, I've seen sometimes toolbars have a |
No, should be fine, particularly with React 16.2.0's addition of Fragment, it should work to do: return (
<Fragment>
{ flatMap( controlSets, /* ... */ ) }
{ children }
</Fragment>
); https://reactjs.org/blog/2017/11/28/react-v16.2.0-fragment-support.html |
Discussed during today's accessibility bug-scrub and agreed to move this issue to Projects, as an enhancement to evaluate for the future. |
All toolbar blocks are now working with roving tabindex on master. Should we close this? |
Yes, let's close. If there are any specific issues, let's tackle them through follow-up issues. Stellar work @diegohaz 🎉 |
Thanks everyone for the effort made here ❤️ |
On current master (eab4b64) keyboard navigation on the top toolbar is broken. Since tabbing is now constrained within the toolbar, there's no way to tab away from it.[Edit: this has been fixed while posting this issue, see comments below]
Constraining tabbing may make sense when editing a block and then moving focus to the toolbar using Alt+F10. Then, pressing Escape moves focus back to the edited block and there's no keyboard trap. However, when normally tabbing through the page content, this is actually a keyboard trap and should be fixed.There have been a few experiments trying to improve keyboard navigation and also some progress, but I think there's no a standardized, simple, solid, pattern yet.
There are also some pending issues, see for example:
The first 2 issues refer to the previous floating toolbars but the keyboard navigation issue still applies. Please let me know if you prefer to close the old issues and handle improvements here.
Wondering what an interaction model that is discoverable, predictable, and standard across toolbars, menus, etc. could be. On #3281 the Inserter is going to use the "roving tabindex" technique suggested in the ARIA Authoring Practices. That seems to work pretty well.
See https://www.w3.org/TR/wai-aria-practices/#toolbar
The technique is better described in the example
https://www.w3.org/TR/wai-aria-practices/examples/toolbar/toolbar.html
Basically, there would be just one tab stop in the toolbar. This would be the control that previously had focus or the first control within the toolbar. Any other control has tabindex=-1 and can be navigated with arrow keys only.
This technique is standard and would have some benefits:
The top toolbar content is now "dynamic" and changes based on the selected block, for example:
Under the hood, it's made of multiple "toolbar" components. However, arrow navigation should work on the main toolbar as a whole (the highlighted section in the screenshots above).
This also means there should be just one element with
role="toolbar"
and it could be a wrapper around the toolbar components.Not sure about the technical side, but I feel the current
NavigableMenu
(which is already used in theNavigableToolbar
) could be adjusted to use just arrow keys and maybe renamed in something likeKeyboardNavigation
.Thoughts and discussion very welcome!
The text was updated successfully, but these errors were encountered: