-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Global styles menu: Avoid visible labels and accessible names mismatch #65124
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 menu: Avoid visible labels and accessible names mismatch #65124
Conversation
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. |
Size Change: -164 B (-0.01%) Total Size: 1.77 MB
ℹ️ View Unchanged
|
fa6ba5d
to
a1c3577
Compare
Happy to help with the code review, but I think this also needs design feedback. cc @WordPress/gutenberg-design |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Special case: Adds a visible label to the 'Palette' button. Note: this is the only visual change in this PR.
This does not following existing UI patterns. I'd encourage not introducing new UI for existing concepts.
The current label made of 'palette icons' of the control is already a unique case that doesn't provide a choesive experience for users. It's not accessible and to me it's not a great design. I see two options:
I'd like to be very clear that controls labeled with only icons must be avoided, especially when the icons are not recognizable and can't be mentally associate to the name of the control.
Any feedback is welcomed but saying 'No' without providing an alternative solution to a valid issue is not acceptable and not welcomed. I think I already pointed out on other issues and PRs that this kind of feedback doesn't help in any way to make WordPress better and doesn't help collaboration in an open source project. Thanks. |
d4c3e20
to
401ea48
Compare
In the last commit I'm entirely removing the 'palette icons' and only using visible text for the label. To recap: these icons used as label illustrated in the screenshot below are not OK. This is not the kind of accessible, inclusive, design I'd liek to see in WordPress: The control is now labeled with visible text only: As a consequence, the 'Theme colors randomizer' button that is shown when enabling the 'Color randomizer' Gutenberg experiment is now moved one level deeper into the 'edit palette' panel. Screenshot: |
One more good reason to move the 'Randomize color' button to the actual Edit palette panel is that the colors icons shown inside the 'Edit palette' button are only the first five colors provided by the theme. Depending on the theme palette, clicking 'Randomize color' may not show any visual change in the five colors icons. For example, in Twenty Twenty-Four the first five colors are all white, black or grays and clicking the Randomize button won't show any change in the colors icons. |
401ea48
to
b4f1f83
Compare
984583b
to
9f64565
Compare
I'd appreciate a new review of this PR. The only visible change is about the 'palette icons'. As mentioned earlier, that design pattern (which as far as I can tell is a unique case in the editor and as such is an ad-hoc, inconsistent, Implementation that should be avoided in the first place is not only not accessible but it's also non-functional as it may not show any change when randomizing colors, depending on the current palette. I'm not opposed to alternative solutions as long as:
Thanks Cc @WordPress/gutenberg-core @WordPress/gutenberg-design |
@jameskoster thanks for your feedback, that could be an option. However, did you try this UI with Twenty Twenty-Four set as active theme? Did you check that, when randomizing colors, those 5 icons don't change at all? As I mentioned, those icons preview is non-functional with some color palettes. I'm not sure why the editor should keep an UI that:
I think these colored icons preview should be moved one level deeper into the 'edit palette' panel and ideally not be arbitrarily limited to 5 colors. They should preview the changes for the entire palette. |
9f64565
to
9d6d09a
Compare
@jameskoster interesting. I wouldn't be opposed to add an icon that represents the concept of 'palette' to the left of the button label. If you can provide one that works well, I'd be glad to add it. However, I don't think that icon can be a functional preview of the actual palette colors. It can't be arbitrarily limited to 5 colors. Any objections to move further improvements to a follow-up? I'd like to unblock this PR because it improves many other parts, not just this button. |
I think the purpose of this PR is to resolve the label inconsistency. Can we discuss in another issue/PR whether the location of the color randomizer is appropriate and whether the 5 color icons make sense? That is, simply add "Edit Palette" to the current button: If the 5 color icons are considered useless, that might mean the palette variation button is useless too. Below are the palette variation buttons in TT4. Note that only 4 colors are shown here, so the difference is more difficult to see. |
That is what I proposed at the beginning of this PR? Anyways, I think moving the Randomizer button is an improvement and I don't see good reasons to not do it in this PR. It's a small, self-contained change. I do see way more complex PRs that introduce changes not strictly related to the original scope of the issue to solve being merged without problems. Sometimes, it's inevitable that the original scope of an issue gets bigger and I'd think the opportunity of a change should be evaluated on a case by case basis to avoid serious 'scope creep', but this isn't the case. |
That's true, but my suggestion is to place it to the right of the color icon, not above it. What do you think about this design? @WordPress/gutenberg-design
While this can certainly happen, I think we should try to narrow it down as much as possible to the problem we're trying to fix. Otherwise, someone looking at a PR for the first time won't know what we actually changed without reading the code and discussion. Also, I think the smaller the PR, the easier it will be to identify the problem later on if we run into a problem. |
It works for me. And agree we should keep the scope of the PR narrow. Moving the randomizer, changing icons, etc. should be discussed separately. |
Sounds good to me (and thank you @t-hamano for keeping the scope of this PR narrow). One last aspect to consider: what do we do if the text doesn't fit in the available space? Truncation or break to a new line? (@jameskoster ) |
Fair enough. I will revert the moving of the randomizer and create another issue and PR. |
I'd lean toward the latter. |
Truncation is not a good content strategy. The FlexItem component allows text wrapping and that's the best option IMHO. |
9d6d09a
to
50aab34
Compare
Latest commit restores the 'Randomize colors' button, the colors preview, and adds a visible label 'Edit palette'. Screenshot: The edge case with a longer string and text wrapping is minor because the colors preview will be removed in a follow-up which will also move the Randomize colors to the edit palette panel. |
Would it be better to wrap the text underneath the swatches to avoid situations where many colors create a very narrow space for the text, and the button grows vertically to extreme heights? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code wise this LGTM, thanks! The only possible small remaining thing is @jameskoster comment. Personally I think the current wrapping looks good, but 🤷
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Would it be better to wrap the text underneath the swatches to avoid situations where many colors create a very narrow space for the text, and the button grows vertically to extreme heights?
For now, the number of swatches will not exceed five, so I think there is no need to worry about increasing the number of swatches.
In the future, when we decide whether to delete swatches, change the design of swatches, or increase the swatch limit, we will be able to adjust the text layout.
@jameskoster @ntsekouras the colors are limited to five. Which is, as I said, an arbitrary number that makes the swatches useless with some color palettes. That's how it works right now and this PR isn't changing that. As such, the edge case illustrated in @jameskoster screenshot above can't happen. This button shows only 5 colors. I created #66169 to discuss removing the swatches and moving the Randomizer to the edit palette panel. |
I'd appreciate an approval... Thanks. |
You have two :) |
Discussed and we can proceed with the current changes
WordPress#65124) * Simplify global styles root menu labels. * Fix and simplify labels in various global styles submenus. * Adjust failing test. * Fix more tests. * Fix one more test. * Entirely remove palette icons and move color randomizer. * Restore randomize colors position and add visible label. Co-authored-by: afercia <afercia@git.wordpress.org> Co-authored-by: richtabor <richtabor@git.wordpress.org> Co-authored-by: ntsekouras <ntsekouras@git.wordpress.org> Co-authored-by: t-hamano <wildworks@git.wordpress.org> Co-authored-by: Mamaduka <mamaduka@git.wordpress.org> Co-authored-by: jameskoster <jameskoster@git.wordpress.org> Co-authored-by: ciampo <mciampini@git.wordpress.org>
Fixes #65112
What?
Removes most aria-label that:
Why?
In such cases, the labels are unnecessary or even harmful for accessibility. Always prefer the visible label to determine the accessible name.
How?
title
attribute.Screenshot of the Palette butto, before and after:
Testing Instructions
aria-label
attribute.Testing Instructions for Keyboard
Screenshots or screencast