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

Global styles navigation button: avoid visible text and accessible name mismatch #66526

Closed
2 of 6 tasks
afercia opened this issue Oct 28, 2024 · 2 comments · Fixed by #66606 · May be fixed by #66535
Closed
2 of 6 tasks

Global styles navigation button: avoid visible text and accessible name mismatch #66526

afercia opened this issue Oct 28, 2024 · 2 comments · Fixed by #66606 · May be fixed by #66535
Assignees
Labels
[Focus] Accessibility (a11y) Changes that impact accessibility and need corresponding review (e.g. markup changes). Global Styles Anything related to the broader Global Styles efforts, including Styles Engine and theme.json Needs Design Feedback Needs general design feedback. [Package] Edit Site /packages/edit-site [Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature does not function as intended

Comments

@afercia
Copy link
Contributor

afercia commented Oct 28, 2024

Description

Similar to #66525

In the Site editor 'site view', the navigation panel > Styles, shows a control to go to the Revisions:

Image

The visible text of this button is, for example:

Last modified 3 days ago

the actual accessible nae provided by the button aria-label is:

aria-label="Revisions"

FOr the same reasons explained in #66525, this kinf od mismatch must be avoided.

Also, interactive controls aren't the right place to provide information about states or values. They have to provide information about the button action.

Step-by-step reproduction instructions

  • Make sure you have some global styles revisions. If necessary, go to the Site Editor > Styles, make any change and save.
  • Go to the main navigation panel in the Site editor 'site view'.
  • Go to the Styles sub-panel.
  • Inspect the source of the button at the bottom of the panel.
  • Observe the visible text is about the last modified date, while the accessible name is 'Revisions'.

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

Please confirm which theme type you used for testing.

  • Block
  • Classic
  • Hybrid (e.g. classic with theme.json)
  • Not sure
@afercia afercia added [Focus] Accessibility (a11y) Changes that impact accessibility and need corresponding review (e.g. markup changes). [Package] Edit Site /packages/edit-site [Type] Bug An existing feature does not function as intended Global Styles Anything related to the broader Global Styles efforts, including Styles Engine and theme.json labels Oct 28, 2024
@github-actions github-actions bot added the [Status] In Progress Tracking issues with work in progress label Oct 28, 2024
@up1512001
Copy link
Member

@afercia can you please review this PR?
https://github.com/WordPress/gutenberg/pull/66535/files

@afercia afercia self-assigned this Oct 29, 2024
@afercia
Copy link
Contributor Author

afercia commented Oct 30, 2024

Thinking a bit more into this, I think the best way to improve usability, accessibility, and consistency is by separating the two informations: action and state should be communicated separately. That requires a design change.

Functionally, this button is a navigation button, as in: users click on it and the editor switches to the revisions view. This action is best communicated with a visible label. Only adding an aria-label="Revisions"' helps screen reader users but isn't helpful for all other users. I would say this is a good example of how _not_ to use aria-label` as the visible text completely mismatches the actual button name and underlying action.

The state Last modified + humanTimeDiff is a valuable information but buttons aren't the right place to communicate states or values.

In this navigation panel there are other examples of 'navigation buttons' that bring users to specific views of the editor. However, in most of the cases, the open a sub-panel of the 'drill-down' menu. That's the reason why the use a chevron icon. Screenshot to illustrate:

Image

I'm not sure a chevron icon would be appropriate in this case because this button does not open a sub-panel of the drill-down menu. To my understanding, the usage of the chevron icon was specifically meant to indicate the drill-down menu mechanism. I can't think of other buttons that directly switch the editor to a specific view other than the vairous 'Edit' buttons in the navigation menu, which use a completely different pattern.

It is also worth mentioning that the humanTimeDiff string mauy wrap in two lines when it's longer. Ideally this should be prevented. Screenshot to illustrate:

Image

Overall, I'd lean towards making things as simple as possible. Something along the lines of the screenshots below could work. With and without chevron icon:

Image

I'll submit a new PR as an alternative to #66535

@afercia afercia added the Needs Design Feedback Needs general design feedback. label Oct 30, 2024
@afercia afercia changed the title Global styles navigation button: avoid visible text an accessible name mismatch Global styles navigation button: avoid visible text and accessible name mismatch Oct 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Focus] Accessibility (a11y) Changes that impact accessibility and need corresponding review (e.g. markup changes). Global Styles Anything related to the broader Global Styles efforts, including Styles Engine and theme.json Needs Design Feedback Needs general design feedback. [Package] Edit Site /packages/edit-site [Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature does not function as intended
Projects
None yet
2 participants