-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Description
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:
- By having the selector relate to the block itself, it provides access to the whole inspector and all tools within, to customize a state.
- By allowing you to combine properties to create a new state, the use case of allowing design of the hover state for the current menu item is handled.
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.
Issue updated May 7th.
Past version of this issue
Examples include:
- hovered
- focused
- active
Update
We've iterated on this in #1786 and #41976.
A video overview is available.
After #41976, the next steps are:
- Fix Global Styles: Elements: Link style rules are being applied to buttons #42055
- support
:hover
onlink
elements within **blocks** in Global Styles UI (currently only top level is supported). - implement the "disclosure" pattern from @javierarce's designs from Add link element
:hover
interactivity control to global styles UI #41976 (comment). - add support for
:focus
and:active
states in the Global Styles UI forlink
. - Add color swatches for the first two "states" in the Global Styles element overview item (see Add link element
:hover
interactivity control to global styles UI #41976 (comment)) - Enable setting Navigation block link color from global styles. Requires Migrate Navigation block color controls to Block Supports #42092 to be resolved as Global Styles checks supports to decide whether to enable the panel.
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.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
Status