-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Standardized way to modify interactive states (:hover, :focus .etc) for blocks #38277
Copy link
Copy link
Open
Labels
Global StylesAnything related to the broader Global Styles efforts, including Styles Engine and theme.jsonAnything related to the broader Global Styles efforts, including Styles Engine and theme.jsonNeeds Design FeedbackNeeds general design feedback.Needs general design feedback.[Feature] Design ToolsTools that impact the appearance of blocks both to expand the number of tools and improve the experiTools that impact the appearance of blocks both to expand the number of tools and improve the experi[Focus] Accessibility (a11y)Changes that impact accessibility and need corresponding review (e.g. markup changes).Changes that impact accessibility and need corresponding review (e.g. markup changes).[Focus] Blocks AdoptionFor issues that directly impact the ability to adopt features of Gutenberg.For issues that directly impact the ability to adopt features of Gutenberg.[Type] EnhancementA suggestion for improvement.A suggestion for improvement.
Metadata
Metadata
Assignees
Labels
Global StylesAnything related to the broader Global Styles efforts, including Styles Engine and theme.jsonAnything related to the broader Global Styles efforts, including Styles Engine and theme.jsonNeeds Design FeedbackNeeds general design feedback.Needs general design feedback.[Feature] Design ToolsTools that impact the appearance of blocks both to expand the number of tools and improve the experiTools that impact the appearance of blocks both to expand the number of tools and improve the experi[Focus] Accessibility (a11y)Changes that impact accessibility and need corresponding review (e.g. markup changes).Changes that impact accessibility and need corresponding review (e.g. markup changes).[Focus] Blocks AdoptionFor issues that directly impact the ability to adopt features of Gutenberg.For issues that directly impact the ability to adopt features of Gutenberg.[Type] EnhancementA suggestion for improvement.A suggestion for improvement.
Type
Fields
Give feedbackNo fields configured for issues without a type.
Projects
Status
📋 Backlog
Status
Now
What problem does this address?
Currently it's not possible to modify the visual styles when the block items are in a given state (hover, focus, etc).
States (#57719) was designed as a solution that could work for this use case, including the hidden complexity that isn't immediately obvious. Consider a navigation menu, you'd want to be able to change colors of menu items in their neutral, hover, focused states. But most likely, you'd also want to be able to change their border, background, perhaps font-weight or text-decoration in those states.
Secondly there is the need to combine properties into new states. Consider the same navigation menu, menu items can have current states. E.g. when you navigate to
/about, the "About" menu item should be highlighted as the current menu item. This state cannot inherit the hover and focus states from default menu items, you might have a blue hover color which wouldn't work if you added a black background:In other words, the state proposal suggests that "Hover" is one property that can make a state. "Current" and "Hover" properties together, make a new state.
The state design can solve both those complexities:
Here are mockups that extrapolate on Saxon's work to test it for both a Button state, and a navigation "current menu item" state:
This could work as a starting point, and as the states concept gains features, it can be expanded upon.
Figma.
Issue updated May 7th.
Past version of this issue
Examples include:
Update
We've iterated on this in #1786 and #41976.
A video overview is available.
After #41976, the next steps are:
:hoveronlinkelements within **blocks** in Global Styles UI (currently only top level is supported).:hoverinteractivity control to global styles UI #41976 (comment).:focusand:activestates in the Global Styles UI forlink.:hoverinteractivity control to global styles UI #41976 (comment))What is your proposed solution?
Provide design tools that allow setting visual presentation for those states.
Likely these will be implemented as an editor-wide feature rather than something that's specific to the Nav block.
I will defer to @jasmussen and @javierarce for their thoughts on how this might happen.
Also pinging @jorgefilipecosta who may have some insight onto whether Global Styles intends to handle this in future.