WordPress / gutenberg

The Block Editor project for WordPress and beyond. Plugin is available from the official repository.
https://wordpress.org/gutenberg/
Other
10k stars 4.02k forks source link

Add template modal dialog: labeling of some TemplateListItems is far from ideal #60175

Open afercia opened 3 months ago

afercia commented 3 months ago

Description

It appears some basic best practices and accessibility requirements aren't well understood yet. It's worth pointing out again that the value of the aria-label attribute overrides any content. As such, the aria-label value should always provide a meaningful name for users of assistive technology and the name must match (or at least start) with the visual labeling.

In the site editor, when creating a new template, a modal dialog opens. In the modal dialog a list of 'template items' is shown. Some of these template items are labeled by their content. For example: Pages, Author Archives, and other ones. However, some template items do have an aria-label attribute that is totally meaningless and confusing for users. It's more a -description_ rather than a name.

Screenshots: the Front Page template items has an aria-label="http://localhost:8889":

Screenshot 2024-03-25 at 15 38 43

Screenshots: the Date Archives template items has an aria-label="E.g. http://localhost:8889/2024":

Screenshot 2024-03-25 at 15 40 45

As such, the accessible name used by assistive technology for these items is an URL that is of no use for users.

Screenshots of the wrongly labeled items announced by a screen reader:

Screenshot 2024-03-25 at 15 45 21

Screenshot 2024-03-25 at 15 45 40

Step-by-step reproduction instructions

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

afercia commented 3 months ago

As pointed out in several other issues and PRs, the name of an UI control and its description are two separate concepts and must be kept separated.

Tooltips aren't meant to provide descriptions. They have been introduced in the editor with only one purpose: visually expose the accessible name of controls that only contain graphics e.g. icon buttons.

The design of this modal must be changed in the first place to separate name from description. If the description is considered something important to provide to users, then it must be provided in a different way, certainly not with a tooltip.