-
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
Improve the top bar tools interaction and consistency #12073
Improve the top bar tools interaction and consistency #12073
Conversation
I can't recall if this is ticketed yet. I think it might be, perhaps #9053 though I might go ahead and change the title — I feel strongly that we should find a way to merge the Document Outline tool, and the Block Traversal button into a single one. Out of scope for this PR, though, but worth mentioning. |
I remember @paaljoachim mentioned it too. |
Since the Document outline and the Block Navigation is so similar it is natural to merge these. I will create an issue for it now.... |
@paaljoachim Can you hold off on that for a bit? We might be able to use #9053 for it instead. There's valuable context worth keeping. |
ad32fb5
to
675eb15
Compare
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.
@@ -74,6 +74,10 @@ function BlockNavigation( { rootBlock, rootBlocks, selectedBlockClientId, select | |||
) | |||
); | |||
|
|||
if ( ! rootBlocks || rootBlocks.length === 0 ) { | |||
return null; | |||
} |
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.
Minor: Could move this check to the top of the function or use the ifCondition
HOC so that we're not unnecessarily computing hasHierarchy
.
Does this need to go in WordPress 5.0.0 / Gutenberg 4.6 or can it wait for WordPress 5.0.1 / Gutenberg 4.7? |
Thanks @noisysocks.
From an a11y perspective, I'm mostly interested in the buttons in the left part of the top bar because they're within a
I'd prefer to have it in the first release, to get user used to this kind of interaction since the beginning. |
Fixes #12040
This PR seeks to improve semantics, interaction, and consistency of the Undo, Redo, "Content structure", and "Block navigation" tools in the top bar, trying to have a more consistent user experience.
Currently, some of these controls are initially disabled and not focusable, other ones are not really disabled and focusable, also the tooltip is visible or not visible depending on the disabled state. See below for more details.
This PR:
BlockNavigationDropdown
and the table-of-contentsDropdown
work similarlyaria-disabled
so they're still focusable and discoverable, also their tooltip is visibleQuoting from the related issue:
Currently, there are at least 3 different initial behaviors that are potentially confusing for users:
Undo and Redo buttons:
aria-disabled="true"
attributeAs discussed in previous issues / PRs, they're not disabled to avoid a focus loss when using a keyboard and there are no more undo / redo steps.
Content structure button:
disabled
attribute, so it's really disabledAs it's not focusable and its tooltip is not visible, the discoverability of this tool is a bit reduced.
Block Navigation button:
From an accessibility perspective, using
aria-disabled="true"
and "noop'ing" an UI control is equivalent to disabling it with adisable
attribute, as long as it is perceived as disabled by all users, i.e. also visually. The relevant difference is that a control witharia-disabled="true"
is still focusable. Removing focusability from disabled elements can offer users both advantages and disadvantages. A must read recommendation can be found in the ARIA authoring practices:5.7 Focusability of disabled controls
https://www.w3.org/TR/wai-aria-practices-1.1/#kbd_disabled_controls
Although those recommendations apply to ARIA widgets, the Gutenberg top bar can be considered a "toolbar", where the ability to discover the functionalities within the toolbar is a primary concern. I'd recommend to adopt a consistent convention for the focusability of these controls and always use
aria-disabled="true"
/ "noop". The Block navigation menu should not open its panel when there are no blocks.Lastly, please do let me know if more consistency in title-case / sentence-case for the tooltips text is desirable. Right now, they're not so consistent: