-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Fix post summary panel controls accessibility #68750
base: trunk
Are you sure you want to change the base?
Conversation
Size Change: +50 B (0%) Total Size: 1.84 MB
ℹ️ View Unchanged
|
1b56842
to
7aa97f1
Compare
46a41dd
to
1ef9aa8
Compare
Flaky tests detected in 1ef9aa8. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/12907207171
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
@WordPress/gutenberg-core I think this is ready for a first review and feedback, appreciated when you have a chance. |
It’s interesting that the entire row for each is now selectable. However, what is the rationale behind shifting the application of color from the value being modified to the label? This introduces an inconsistency, as Gutenberg does not apply primary color styling to labels, which could impact visual hierarchy and user expectations. Labels typically serve as guides, while values often signify actionable elements. Also, there would be another differently applied hover state (almost every element here has a different hover state): CleanShot.2025-01-27.at.11.42.25.mp4 |
FIxes #63992
This PR aims to address a long standing issue where some editor controls (visible labels + buttons) are designed to provide 1) a setting name 2) the current value or state.
See
#470
#63308
What?
The fundamental, long standing, problem with such a pattern is that currently the value / state is used for the visible label of the button. This is less than ideal because buttons should be labeled to communicate what they are about, not the value or state.
In some cases, these buttons are complemented with an
aria-label
attribute e.g.Change status: {value}
that does clarify the what for blind screen reader users but it introduces a mismatch between the visible text and the actual accessible name that impacts other users, e.g. sighted screen reader users or voice control users.Why?
Buttons should be labeled to communicate what they are about. They are not the right place for values or states.
A complete mismatch between visible text and accesible name must be avoided.
How?
This PR aims to establish a new pattern to have controls (buttons) communicate both the what (the setting name) and the value or state in an accessible way.
The key point is that the accessible name must be visually exposed and must not be altered by the value or state. To do so, name and value/state must be semantically separated while, visually, they can be presented together.
PostPanelRowButton
that is a wrapper around the Button base component.PostPanelRowButton
.PostPanelRowButton
does two important things:label
prop as part of the visible text and accessible name of the button e.g.Status
.displayedValue
prop to:Status, Draft, button
.Click Status
to activate the button.PostURLPanel
when it shows the front page link. This seems a reasonable exception to me because the value is, well, a link.Example screenshot:
Note 1:
I removed the tooltip used to show the full publish date/time for a few reasons:
Note 2:
PluginPostStatusInfo
slot should not be affected by this change. The fills renders normally at the end of the panel. However, if plugins add controls that used to replicate the previous design, they may want to adapt to the new one. Screenshot of a demo fill:Testing Instructions
Test at least in 3 places:
Post editor, editing a post:
Post editor, editing a page:
Site editor, editing a template:
Worth reminding the 'Publish' date/time setting should be tested for several cases:setting the site timezone to different values:
Immediately
.Today at {time}
.Tomorrow at {time}
.Testing Instructions for Keyboard
Screenshots or screencast
Before and after screenshots for: post, page, front page, template.