-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Update the Button
component
#63856
Comments
I note that 'Focus' is excluded from this array of styles; is that because it's primarily added outside the button, via outlines, or for some other reason? I feel like it should be included for completeness. |
You're right, they should be included. I'll update the diagram :) |
Just a quick note that I'd love to see a more descriptive title for this issue. |
Something like this shimmer effect (codepen) could be fun to try for the busy state: |
This issue seems like it would be relevant to any button redesign: The ability to include icons alongside text labels would be a win for usability. |
I've updated the matrix of button variants to ensure consistency, here's the design for it: Additionally, consolidating the For the busy state design, while the shimmer effect might be engaging, it could present accessibility concerns for users sensitive to flashing elements. Here’s a CodePen example featuring a simpler loader that might be a safer choice: You can also view a demo of this loader here: demo.mp4Looking forward to your feedback! |
I agree that the shimmer effect could be problematic; although as long as it respects This panel of designs is still missing |
Thanks for sharing @seifeldinio :) I'd be interested to get feedback from @WordPress/gutenberg-components on the idea of using a spinner for the busy state. We'd need to ensure the button retains it's width which might add some complexity? Ideally the visuals would match the native For the disabled states it would be good to avoid opacity; that method won't work as well as solid colors for different color schemes (#53612). Additionally I'd say the disabled primary/destructive buttons are commanding too much attention. Let's explore some more options there. Finally, a consistent focus treatment could be worth exploring, for example always using an outset focus ring: This convention can be applied consistently across all components, and in this case ensure the same footprint for all button types. |
It shouldn't be problematic if we basically overlay and center a spinner on top of the existing button. Do you have some mockups to share? |
FWIW it used to be a common practice to have spinners inside buttons in Bootstrap: https://getbootstrap.com/docs/4.4/components/spinners/#buttons |
As with most interactive elements it's not easy to judge the design by working with static files, so I've started exploring Buttons on codepen (please excuse the spaghetti code). Some notes on the designs that it would be good to discuss:
Additionally guidelines should be written around when each variant should be used, do's/don't's, etc. |
Thanks for working on this, @jameskoster !
border-cta.mp4
To me it feels weird that the focus ring is blue when the button is destructive. But that's maybe a personal preference.
This gray treatment will help a lot when combining primary and secondary CTAs and the primary is disabled for some reason. Thanks for working on it!
Love it! |
It did to me as well until I looked around and saw that very few design systems seem to colorise the focus ring, either for destructive buttons, errored inputs, or anything really. That doesn't mean we shouldn't, but it seems a good moment to question it. Perhaps there are some a11y best practises to guide this one way or the other... cc @joedolson. |
The purpose of the focus ring is to draw attention quickly, so that a user can quickly and efficiently locate where they are focused. While I'm not aware of any standards governing whether it should be colorized or not, in my opinion consistency is going to be a big part of making it easy to find - and if it changes color depending on the state of type of control, it's going to be harder for a user to spot. In my opinion the focus ring should only represent one thing: focus. It doesn't need to also represent the state or type of control; the control design should be doing that job. |
I discussed this with some designers yesterday and have reverted back to |
As for this point, I'm leaning towards sticking with the current de facto style logic in our UIs, which is to use I also think it will be much easier for us to maintain consistency across the app, just because that rule is much more simpler than having to assess from an affordance perspective whether each element needs |
Yup, I'm on the fence about that one, so very happy to defer for now. One other piece of feedback I've seen is that the secondary button style is too strong. A contrast preference would remedy that byconditionally reducing the strength of the stroke, but I wanted to open the door to any other potential ideas. There are a few options we might consider like;
I'll create some mockups when I get a second. |
Here are a couple of alternative options for the The top two are variations on a theme; the bottom border provides contrast and a subtle gradient helps distinguish from text inputs. Bottom-left tries a much subtler background color and no stroke. Bottom-right tries a much subtler stroke color. In both cases font-weight is relied upon in order to indicate the element is interactive. There are drawbacks to this as outlined in #63856 (comment). I'm not entirely sure any of these meet accessibility guidelines. Curious to hear any feedback. |
Agreed that hover styles are necessary — and I also don't mind @crisbusquets 's exploration with thickening the border as an alternative to changing border color.
I agree with what Lena said above.
Agreed — we can apply whatever is decided in #63756
I'd personally say that having visual cues to show what parts of the UI are interactive is necessary — whether that happens via
To be future-proof, let's also consider theming in mind: ie. what if the button's main color is fully desaturated? Applying a gray scale filter in that case would not cause any visual differences. The obvious choice is also also apply reduced opacity on the button's contents (but not the focus ring), but I'd be open to other alternatives.
Agreed on the focus ring changes — and also agree on applying a consistent focus ring color as suggested by Joe above
Looks good
Style overrides per se are ok if applied on “outer” styles (positioning, flex child properties, sizing to a certain extent). We discourage style overrides when:
In that sense, if the only thing that changes for "full-width" buttons is their external
Does that mean that, by default, a button without a specified variant would render with "tertiary" styles? Given that we may discourage using tertiary buttons in certain scenarios for their lack of visual interactivity hints, would it be a good choice to default to tertiary?
I didn't perceive the secondary button style as "too strong" — to me it feels like a good balance between the primary (which is definitely "strong") and tertiary (which is very subtle).
The gradients to me feel foreign to Gutenberg's style. Of those 4 alternatives, I prefer bottom left and bottom right — although I agree that bottom left would be hard to pull off consistently when adding theming in the mix. |
I'll try it in the codepen :)
To clarify, there are two combined effects. One is a semi-transparent overlay, the other is a grayscale filter. So if the theme uses grey for the primary color, disabled buttons would still appear lighter.
Good questions. A cursory glance at other design systems reveals that generally our 'secondary' style is the more common default. That makes sense given the quirks around the borderless Ultimately I feel the guidelines should provide clear instructions about when to use each variant, and the default should effectively be irrelevant. This would include instructions to not use the |
I updated the codepen. The secondary variant now features a I also added the alternative approaches to the For me both of the alternatives feel a bit more balanced next to the primary variant. I have a slight preference for the version with the lighter stroke. Keen to hear feedback! |
Personally, no strong preference here — I think that all 3 options for the "secondary" variant could work. As I said earlier, the only challenge I see with the third option (ie. no border, light background color) is that it may not always work well depending on the choice of primary color (something to keep in mind when enabling theming). |
Gradients may be out of vogue with many modern design styles, but they are very useful for conveying what's interactive and what isn't. I would welcome a move back in that direction. |
Could you expand on that? In which situations would it not work well? |
@cbirdsong Absolutely! What I was trying to say, is that currently I don't see gradients being used in Gutenberg design language.
@jameskoster I'm mostly thinking about theming. Let's take this secondary button design proposal into account: In terms of colors:
But if we allow for theming, users could specify any primary color. And when that happens, we're not guaranteed that those same tweaks that worked well for our default primary color will also result in a pleasant/accessible design for the new custom primary color passed via theming. Of course, the same could happen with a white background, if the primary color doesn't have enough contrast against white anyway. And I also realize this is definitely an aspect that will affect theming in a broader sense (ie. do we allow users to define any color as the primary theme color? how do we calculate internally all the variations of the primary color? how do we make sure we can still retain the changes in lightness / saturation and ensure enough contrast? etc). In short, my feedback is not blocking for the |
Got it. The work Saxon was doing around the theme component / color scales should actually ensure this works, pretty much regardless of the spot color from which the palette is generated. |
Thanks for adding consistency. From the visual changes to the base resting states, it's not clear a design has been found that improves upon them from what they are today (referring to color changes, shadows, gradients). This is especially important to consider in context of the fuller interface, such as seeing it inside an inspector and a modal, to ensure belonging. |
Perhaps that's the best approach? Extracting this and proposing it in isolation with a broad ping? |
Referencing this PR for visibility and feedback for the future:
|
Is it feasible to rename variants? |
I'd say yes. As long as the new names don't collide with existing variant names (e.g. renaming |
Buttons are a ubiquitous element in most apps, a solid design can help elevate the polish of the overall UI/UX.
Here's a matrix of the current variants / states of the
Button
component.Issues
isPressed
doesn’t seem to have much use outside thedefault
variant. It indicates whether a button is toggled on or not, e.g. “Bold” in the block toolbar.tertiary
variant?primary
variant are very prominent, and draw a lot of attention given their un-interactivity.secondary
andtertiary
variants) it’s not obvious that the element is a button when it appears in close proximity to body text.:focus
meaning they appear on click. We might consider moving those styles to:focus-visible
so they appear on keyboard interaction instead.secondary
button removes the focus ring.Let's refine the list of issues before exploring potential solutions. Do you agree with this list? Are any items missing?
Task list
Based on the discussion in this issue, here's a list of items to be implemented. Refer to this codepen for demonstrations.
default
withtertiary
focus-visible
The text was updated successfully, but these errors were encountered: