Skip to content

Template menu: Fix semantics of the Preview template menu item #57455

Closed

Description

Description

See #56817

The 'Template preview' menu item in the template manu has:

  • role="menuitem"
  • aria-pressed true or false

This is incorrect. The aria-pressed state can only be used with the role=button (native buttons or elements with that ARIA role).

It's not just a matter of forma compliance. Screen readers will not announce the 'selected' state of the menu item. This should be instead:

  • role="menuitemcheckbox"
  • aria-checked true or false

It's no different from what already done for other dropdown with role="menu", for example the Options nenu:

  • A role="menu" should only contain menuitem, menuitemcheckbox, menuitemradio, and optionally groups.
  • Normal menu items have a menuitem role.
  • Menu items with a checkable state must either have a menuitemcheckbox or a menuitemradio role.
  • For both menuitemcheckbox and menuitemradio roles, aria-checked is a required state.

Step-by-step reproduction instructions

  • Test with Safari and VoiceOver.
  • Tab to the template menu in the Document settings and open it.
  • Tab to the 'Template preview' menu item and press Control+Option+Spacebar to check it and uncheck it.
  • Observe that in both checked and unchecked states, the state is not announced.

Regardless of the visual checked state and the (incorrect) aria-pressed value, VoiveOver always announce the item as 'menu item' and does not announce the state. Screenshot:

Screenshot 2023-12-29 at 14 36 26

Screenshots, screen recording, code snippet

No response

Environment info

No response

Please confirm that you have searched existing issues in the repo.

Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

Yes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Labels

[Focus] Accessibility (a11y)Changes that impact accessibility and need corresponding review (e.g. markup changes).[Package] Editor/packages/editor[Status] In ProgressTracking issues with work in progress[Type] BugAn existing feature does not function as intended

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions