Skip to content
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

Navigation block: Change aria-haspopup to dialog #55466

Merged
merged 1 commit into from
Oct 20, 2023

Conversation

alexstine
Copy link
Contributor

What?

Changes the aria-haspopup="true" to aria-haspopup="dialog" for the navigation block mobile menu trigger.

Why?

The trigger opens a menu but it is actually a dialog.

https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-haspopup

The availability and type of popup the interactive element will trigger should be identified with the aria-haspopup state.

Since the trigger always opens a dialog and a menu is contained within the dialog, I think it is more correct to say the button opens a dialog, not a menu.

How?

Changes the attribute.

Testing Instructions

  1. Start a screen reader.
  2. Create and insert a navigation block.
  3. View the front-end.
  4. Zoom in until you reach mobile view.
  5. Check the mobile menu button to see if it contains aria-haspopup="dialog".
  6. Screen reader should announce that the button opens a dialog vs. a menu.

Testing Instructions for Keyboard

No keyboard change.

Notes

Interested in gathering other Accessibility Team opinions to make sure I'm not totally off base here.

@alexstine alexstine added [Type] Bug An existing feature does not function as intended [Focus] Accessibility (a11y) Changes that impact accessibility and need corresponding review (e.g. markup changes). [Package] Block library /packages/block-library Needs Accessibility Feedback Need input from accessibility [Block] Navigation Affects the Navigation Block labels Oct 18, 2023
@alexstine alexstine self-assigned this Oct 18, 2023
@github-actions
Copy link

Flaky tests detected in d8a369e.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/6567273657
📝 Reported issues:

@SantosGuillamot
Copy link
Contributor

It looks good to me, although I'd prefer if the Accessibility Team takes a look as well 🙂

@joedolson
Copy link
Contributor

It's better than using aria-haspopup="menu"; dialog is more appropriate than menu, I agree. The dialog value is pretty widely supported by AT/browser combinations - it's not fully supported in Narrator/Edge or in Talkback/Chrome, but in both cases it just falls back to more generic behavior, announcing a popup, which is sufficient to convey action.

Copy link
Contributor

@jeryj jeryj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fix, @alexstine and thanks for the further a11y spec info, @joedolson!

@alexstine alexstine merged commit c1a3d5a into trunk Oct 20, 2023
61 checks passed
@alexstine alexstine deleted the fix/navigation-haspopup branch October 20, 2023 01:11
@github-actions github-actions bot added this to the Gutenberg 17.0 milestone Oct 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Navigation Affects the Navigation Block [Focus] Accessibility (a11y) Changes that impact accessibility and need corresponding review (e.g. markup changes). Needs Accessibility Feedback Need input from accessibility [Package] Block library /packages/block-library [Type] Bug An existing feature does not function as intended
4 participants