-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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 accessible description of current Navigation block state #53469
Conversation
Size Change: +149 B (0%) Total Size: 1.5 MB
ℹ️ View Unchanged
|
Flaky tests detected in 23c7e14e5eb89a9364ec8db3242cf1041e7076ad. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/5830821196
|
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.
Nice and simple. Thanks! 👍
Thanks Alex. Now we have the approval on the general approach from the a11y front let's refine the technical implementation and get ready for merge. |
1c78cec
to
3a9f4bf
Compare
I pushed a commit to this to make AccessibleDescription a wrapping component. The advantage of this approach is that it makes the implementation simpler - the consumer only has to add the component - there's no need to add the additional props to connect them together. If this isn't a good idea feel free to revert my commit. |
packages/block-library/src/navigation/edit/accessible-description.js
Outdated
Show resolved
Hide resolved
packages/block-library/src/navigation/edit/accessible-description.js
Outdated
Show resolved
Hide resolved
Can't quite recall how it was before but thanks as what we have now seems fine. I moved it to utilise What do you think about merging this one? |
Did another accessibility check. Still looking good. 👍 |
@scruffian This one is ready "as is". I know I overwrote your changes but shall we just merge it and then you can follow up with your additional changes? I'm relatively relaxed either way. |
if ( isPlaceholder ) { | ||
return children; | ||
} |
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 like that this component has to know about the concept of a placeholder.
<AccessibleDescription | ||
id={ accessibleDescriptionId } | ||
content={ __( 'Unsaved Navigation Menu.' ) } | ||
isPlaceholder={ isPlaceholder } | ||
> | ||
<TagName { ...blockProps }> |
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.
IMHO this change makes the code more complex and harder to reason about.
Questions I would ask as a developer seeing this for the first time:
- why is this
AccessibleDescription
component wrapping the main tag? - how does this work (I now need to dive into the code).
- why does the
AccessibleDescription
need to know aboutPlaceholder
? - what is
accessibleDescriptionId
and why isn't it just part of theAccessibleDescription
?
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 think the last commit makes the code more complex and harder to reason about.
Whilst there is more verbosity in the original approach it is simpler and clearer and I think that outweighs any benefits derived from the approach in this latest commit.
My opinion is that we revert to the previous state, merge and then follow up if we feel this new approach still has merit.
23c7e14
to
93e0f7f
Compare
Thanks for the review Dave. I have removed my commit, so I think this is good to go! |
Thank you for being open to feedback. I appreciate it 🙇 |
What?
Adds accessible description of current state of the Navigation block.
Closes #47020
Why?
Current accessible feedback is that the current state of the block is not easily perceivable.
How?
Adds a description indicating which Navigation Menu is currently being used.
Testing Instructions
Saved Menu state
Accessibility
panel in devtools to check description reads "Navigation Menu: %%MENU_NAME%%".Unsaved Block State (no menu)
Accessibility
panel in devtools to check description reads "Unsaved Navigation Menu".Testing Instructions for Keyboard
Screenshots or screencast