-
Notifications
You must be signed in to change notification settings - Fork 4.7k
@wordpress/ui Button: tweak disabled styles and rework tokens
#74470
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
Conversation
|
A few things to consider:
|
|
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: -1.25 kB (-0.04%) Total Size: 3.05 MB
ℹ️ View Unchanged
|
|
Flaky tests detected in b5343df. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/20958790157
|
Is there anything you're concerned about? It seems it'll still be possible to use a light gray background for disabled elements (which is something we might want for some disabled inputs), is that right?
Any reason not to? That seems like a correct application to me. Edit: I suppose there's a question about whether using a
Where feasible we should aim to keep things as close as possible. This change actually moves us closer to parity :) |
efc12f6 to
4c4dfce
Compare
|
Rebased to include the recent addition of the
It is by using the The Are you ok with this scenario?
Yes, this is what I was concerned about (sorry for not being more specific in my previous comment). That makes sense, although we are doing the opposite for the I guess it would be good to document how we're thinking about this and apply it as consistently as possible? I believe originally our approach was for having as few tokens as possible, but I'm not sure if for this case we'd still apply the same reasoning.
Awesome! Separately, one additonal aspect that I wanter to bring up is that, in the outline variant, the text and the border are not the same color (text is |
|
Not a strong opinion, not offering blockers. The disabled state in this case looks slightly too emphasized to me, in all three versions, though especially the solid versions. Noting that the reason there is no contrast requirement for disabled elements is to ensure there is visible contrast between enabled and disabled buttons; you shouldn't be confused whether a button is interactive or not, even at a glance. Can we make them lighter? |
| --wpds-color-bg-interactive-neutral: #00000000; /* Background color for interactive elements with neutral tone and normal emphasis. */ | ||
| --wpds-color-bg-interactive-neutral-active: #eaeaea; /* Background color for interactive elements with neutral tone and normal emphasis that are hovered, focused, or active. */ | ||
| --wpds-color-bg-interactive-neutral-disabled: #e2e2e2; /* Background color for interactive elements with neutral tone and normal emphasis, in their disabled state. */ | ||
| --wpds-color-bg-interactive-neutral-disabled: #00000000; /* Background color for interactive elements with neutral tone and normal emphasis, in their disabled state. */ |
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.
This change in particular (bg-interactive-neutral-disabled) is going to have wide-ranging effects, on at least the following components:
- Checkbox
- Radio
InputLayout-based components, like Input and Select
Disabled states are going to be significantly harder to distinguish with a transparent background with these. But I also understand the desire for a weaker visual prominence. @WordPress/gutenberg-design Any preferences here?
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.
It's probably a detail to explore separately. We can still use --wpds-color-bg-interactive-neutral-strong-disabled for a non-transparent background, but I don't think this is terrible:
IBM Carbon Radio for comparison:
The lack of any hover styles on disabled inputs will also help.
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.
It's probably a detail to explore separately.
Ok, I'll ask for design review when these come up soon.
Agree about the solid variants in particular. I think we can address that by mapping |
8ebe4ec to
2eda160
Compare
|
I rebased on top of latest trunk and pushed a couple of updates: Mapped
|
| Before | After |
|---|---|
![]() |
![]() |
Removed *-disabled DS color tokens for brand and error tones when they are the same as the neutral counterpart
This is a tenative approach based on my previous comment, to which @jameskoster replied "There's not much benefit in creating a bunch of disabled brand tokens as they'll essentially end up 'neutral' anyway."
As such:
- I removed the
bg-interactive-brand-disabledandbg-interactive-error-disabled=>bg-interactive-neutral-disabledcan be used instead - I removed the
bg-interactive-brand-strong-disabledandbg-interactive-error-strong-disabled=>bg-interactive-neutral-strong-disabledcan be used instead - I removed the
bg-interactive-brand-weak-disabledandbg-interactive-error-weak-disabled=>bg-interactive-neutral-weak-disabledcan be used instead - I removed the
fg-interactive-brand-disabledandfg-interactive-error-disabled=>fg-interactive-neutral-disabledcan be used instead - I removed the
fg-interactive-brand-strong-disabledandfg-interactive-error-strong-disabled=>fg-interactive-neutral-strong-disabledcan be used instead
As usual with tokens, there isn't a clearly right approach, but it's mostly a matter of compromises. In this case, we'd be reducing the number of tokens, in exchange for more indirection (ie. brand and error tones don't have dedicated disabled tokens). How does it feel like?
Note: there may be a couple extra changes to apply to tokens, potentially:
bg-thumb-brand-disabled: thebg-thumbgroup of tokens only has a disabled token for the brand variant (since the thumb doesn't exist in neutral tone), although I'm not sure if we'd also like to rename it toneutralfor consistency?- the
bg-interactive-neutralandbg-interactive-neutral-weaktokens have the exact same values across the line (includingactiveanddisabledstates): do they make sense as a separate set of tokens, or should we remove them too?
Again, this is mostly about creating a set of conventions and rules that make sense for us. We could de-duplicate tokens very aggressively, although I feel we'd get to a point where the UX of consuming tokens would really suffer, and the tokens would become less and less "semantic" and much closer to being renamed "primitives"
|
In summary, the high-level design decision here is that disabled elements should always convey a neutral tone. This seems like a good direction to me and strengthens the overall visual language. Reflecting it in the tokens makes sense as well. For the button itself, I think it would be okay to use |
If we do that:
|
@wordpress/ui Button: tweak disabled styles@wordpress/ui Button: tweak disabled styles and rework tokens
|
Update: after talking with @jameskoster , we agreed on applying some changes to the tokens. In an effort to reduce ther amount of tokens where possible (wihout compromising on their semantics), we made the following changes:
I also tweaked the I updated the Separately, I feel like we could now really benefit from a proper VizReg setup to keep track of all the ripercussions when tweaking DS stuff (especially when the changes happen in a different package, such as Theme) |
51633a7 to
ec24acb
Compare
|
@mirka @jameskoster quick check that everything looks good with you before merging? |
|
|
… same as the neutral counterpart
…ive, bg-interactive-neutral-disabled tokens They are the same as bg-interactive-neutral-weak-*
…tokens The bg-interactive-brand-weak-* can be used instead
…ter color This matches all other fg-interactive-neutral-[emphasis]-disabled options
ec24acb to
ba21dfe
Compare
|
|
||
| - Tweaked the values of the following tokens ([#74470](https://github.com/WordPress/gutenberg/pull/74470)): | ||
| - `--wpds-color-bg-interactive-neutral-strong-disabled` from `#d2d2d2` to `#e2e2e2`. | ||
| - `--wpds-color-bg-interactive-neutral-weak-disabled` from `#e2e2e2` to `#00000000`. |
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.
The distinction isn't too important now, simply because we ourselves are mainly going to do any reconciliation tasks, but in the future, I think changing a color from a solid to transparent counts as a breaking change. As a consumer, I definitely need to check usages of this token to see if there're any problems.
| - Removed the following tokens ([#74470](https://github.com/WordPress/gutenberg/pull/74470)): | ||
| - `--wpds-color-bg-interactive-neutral`: use `--wpds-color-bg-interactive-neutral-weak` instead. | ||
| - `--wpds-color-bg-interactive-neutral-active`: use `--wpds-color-bg-interactive-neutral-weak-active` instead. | ||
| - `--wpds-color-bg-interactive-neutral-disabled`: use `--wpds-color-bg-interactive-neutral-weak-disabled` instead. |
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.
Nice that consumers can probably just pass this changelog to a coding agent to make the required changes, no codemod necessary 😄
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.
that was the plan :D
Co-authored-by: Lena Morita <lena@jaguchi.com>



What?
Tweak
Button's disabled stylesWhy?
Currently, all disabled buttons look the same regardless of the
variant— this PR introduces some visual tweaks so that eachvariantlooks different even whendisabled.In particular,
outlineandminimalvariants are less visually heavy when disabled.How?
Testing Instructions
See Storybook examples
Screenshots or screencast