-
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
Consider a standardized way to modify hover/focus/active states for blocks #27075
Comments
I would love to see more consistency in the way hover/focus/active states behave themselves, which to me leads to a more consistent way for them to be styled. I have been working on an example to refine the gallery block borders (#27312), which overlapped. Even a small change like that was a bit of a tangled thread to follow due to the nature of the block. Which makes me feel this is an opportunity to refine and standardize. |
I've been working on Seedlet's button hover states and I feel like the solution that I found shouldn't have to be replicated for every theme that is ever developed. Even if it's never surfaced to the user the ability to change the hover color/background should be handled by the editor to some capacity. In particular when the color is one that is selected by the user and not one provided by the theme. For the particular case, I was considering that we could either play with the opacity of the background color (using rgba) or play with the lightness (using hsl). Could this be done directly within the editor? As it stands, a custom colored button doesn't have any hover state. |
Changing the color alone is not enough to indicate that the state of the link (button block) has changed, If there is a hover color option exposed to users, it may need to be a selection of suggested accessible colors, based on the current button color(s), and refreshed if the user changes the button color. |
I added recently an issue: #30068 I suppose that |
I'm going to add this for discussion in the Core Editor chat. It's something we are going to need for the Navigation block. |
Right, but this should really be handled by Gutenberg rather than every theme having to maintain their own version of this code. |
What is a theme for, then? |
I disagree. The option for the user to be involved should be there, with the ability for theme authors to disable user customization of this feature if they wish. That is how the Block Editor has operated since being merged into core, and long term, that is the best approach. Provide the most flexibility and add curation/locking/limiting options that theme authors can utilize (I want to emphasize that flexibility without the ability to curate/lock/limit is terrible, and features should be developed in tandem with their ability to be locked down). This is important because a very large part of the WordPress end user community are DIY-ers who often start with a theme and then customize on top of it. I'm not a DIYer, but even if I find this helpful when I'm working on personal projects and need to do modifications quickly. |
This implies that Gutenberg could handle every style a designer throws at a frontend developer. Considering Gutenberg competitors with a far superior scope (like Webflow, Squarespace, Wix), this is simply not the case. You will always be locked in by the capabilities of what the editor team deems worthy and would stifle innovation and creativity outside of what the team anticipated. |
@critterverse Channing shared a link to @javierarce post here which is interesting to share into this issue: http://work.javierarce.com/2021/09/14/interaction-of-color/ |
Thank you for the varied opinions expressed here. It's really great to see this discussion evolving. For my part, I'd like to add that I don't see this as a binary choice. My opinion is that handling some basic interaction styles (such as color) would be appropriate for the editor to handle. Indeed, many users will likely want to be able to have some control over these most basic of design choices. That doesn't mean however, that Themes won't still be able to augment or override those settings via CSS to provide additional creativity. We could even have an option within What we don't want is anyone to be "locked in" or for any creativity to be stifled. I hope what I'm suggesting above addresses at least some of those concerns. |
Braindumping some thoughts regarding a particular detail we should address is how user choices affect states. A theme may want to set the blue color for the rest state and the yellow one for hover. Is the user sets the rest color to a yellowish base, is it still good to have yellow for hover? A related though is that different states may require any CSS property to update, like for example padding or margin, as in this use case. In this sense, states are more like "block style variations" than they are "style properties". One of the issues is that the theme lacks information about whether an user has styled anything. Or rather, there's no way for a theme to "maintain the design links" when the user edits something. I've shared a potential direction to explore. |
Updating properties that affect layout on hover/focus is generally considered a very bad idea. Would we really want to encourage that? |
For anyone watching this Issue you might like to keep an eye on #38277 which is where design progress is being made on this problem. |
I'm not sure if this is still in progress, but the PR was closed so I've removed the assignment and In Progress label.
@getdave From a triage point of view, what do you think about rewording the title and description of #38277? It seems like the conversation is no longer about the nav block, and it has become a duplicate of this issue. Potentially this issue could be closed or become an overview while #38277 becomes the design exploration. I also don't think we want separate issues for adding hover states to individual blocks because that would become unmanageable. I just closed #42829, but I think it's confusing for the reporter that I'm pointing them to an issue for the nav block. |
I agree @talldan. Let's close this one in favour of #38277 which, for whatever reason, has become canonical.
It's still on my radar but I've switched focus to the Nav block for a while. |
Gutenberg should consider adding a way for users (and/or theme developers) to modify hover and active states. This would ideally be available in the UI on a per-block level, and also a part of global styles. This feature would be particularly useful for link styles and also for buttons.
Related to #4543
The text was updated successfully, but these errors were encountered: