-
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
Styles: show a hierarchy of styles clearly (theme, user, global unspecific, global specific, local, etc) #49278
Comments
As an example of style inheritance reflected in a few ways:
The added nuance here is that in the block editor, we are talking not just about CSS inheritance, but also about global styles inheritance, such as inherited content/wide widths. And even further, you might set a block default in Global Styles > Blocks, and then override it locally in a post. In the future you might even set ref'ed colors (Set the background color of this button to the same color as the global text color). Finally, there's theme inheritance. You might activate a block theme that has a default root padding. You might then create your own style variation of that, which has its own root padding. It needs here to be visualized that your style variation is replacing root padding values that exist in theme.json. Sharing these examples as context for a design that tackles this, that ideally such a design can tackle these, while still being minimalistic, and perhap ideally with a way to navigate to each origin. Related: |
I ended up creating #50659 instead of updating this one. I'm happy to close the other one and use this one? Let me know. |
It might seem silly but I've linked to this one a fair amount. Mind closing yours and sharing the designs here? |
Not at all, the other one was created by mistake! Updated this one. Thanks Anne! |
Passing along feedback from the FSE Outreach Program's Rapid Revamp call for testing that underscores how painful this currently is:
|
I see where you're coming from, but I worry that when you see a full editor with a canvas, a top toolbar, and a taller inspector, and end up with a bunch of purple splotches, it'll inevitably add some weight to what is, truly, a power-user feature. In that light, I would not highlight items inside an itemgroup — I'd still keep it label-specific (you could still click a color item, and we could add a label you can hover in the flyout). I wonder, can we add some purple on hover only? I.e can we still have a more muted treatment of the resting state? (Perhaps it's still my recent AFK that's in my blood but coming back to this I'm even thinking that the dashed underline is too prominent here 🤔 ) |
Oh that's interesting. So anything that's inherited, regardless of origin, shows programmatically detected values, but anything else have a dot. How would the slider in your example look, in either state?
|
These are the states I think we need to account for:
The second point(s) is the one that is most important to communicate to users. Here's a comparison of the approaches above: Highlighting local overridesHighlighting inherited defaults from style provider |
I updated the OP to include detailed versions of the designs as discussed throughout the issue. We can (and should) continue to discuss, but hopefully it's ready to be picked up for development. |
I've created a very first and very small attempt to tackle the issue of showing whether a particular value is inherited or not and to validate the approach. It only works for the text color at the moment: |
@SergeyBiryukov, @carolinan and myself quickly looked into this issue this morning. Chimin in to quickly note that any informration about the 'inherited' style/setting must be provided in an accessible way. Looking at this mockup, it seems less than ideal:
Ideally, for better clarity for all users and better accessibility, visible text is always preferable. It could be something along these lines:
|
As an update, #37752 is in a place where it can serve as a good first step. |
When no styles are detected
When styles cannot be detected (from a style provider like global styles / theme.json) no controls are displayed. This eliminates the confusion between undetectable inherited styles (e.g. custom css, browser styles) and empty/unset controls. See #43082 for additional context.
Working globally
Respecting the convention above, panels are empty until a value is set (either in the UI, or via theme.json).
Working locally
When working locally there are three states to consider:
Inherited values
If a value is inherited (e.g. from global styles) the control displays that value, and the label has a purple accent denoting the global context. Hovering/focussing the label reveals the source in a tooltip. The control cannot be removed because if there's no local setting, the inherited value will be used.
Local overrides
If an inherited value is changed then a blue dot is appended to the label. Clicking the dot reveals a menu where the user can reset to the global default, or push the value upstream. Some controls (like background image, see below) may need an additional action to 'unset' the value locally.
Local styles
Styles can be added to a block in the local context that have no inherited value. The manifestation of this in the UI is essentially the same as the "Working globally" case above:
With one caveat: If a global style for this property is later added, the local control would then exhibit the blue dot.
Examples
In addition to the block-spacing example above, here are a couple others that have come up in other issues recently. In each case the edit context is local to a document:
Lightbox
Background image
Breakdown
This doesn't all need to be implemented at once. The work could be broken down into the following steps:
Important note
The purple accents used to indicate inherited styles in the mockups above could be a bit heavy-handed in practise. We should continue to explore other design solutions for this.
Original issue
Knowing what style is affecting something on a theme is difficult (is it a global element? is it coming from a block type? is it local to the template?). This has shown up in a few areas already, from Custom CSS https://github.com//issues/47946 to the general experience of conflicting styles https://github.com//issues/45086 https://github.com//issues/44931. To improve this, we should find a way to show a hierarchy of styles clearly (theme, user, global unspecific, global specific, local, etc). While building this, we should also consider ways to push or transfer something to the right level when working through a design, which relates to https://github.com//issues/44931In most cases understanding this style hierarchy is not crucial, as you can accomplish most of what you need to without the visualization. You go to global styles to style site wide, you edit pages to style locally. Nevertheless for more complex sessions, it can be useful to surface, but due to the rarity of needing to surface this, the footprint and UI weight of any visualization feature needs to be small.
Here's a take that makes the design tool label clickable to reveal the inheritance:
For this concept to work, the Color flyout has received its own label.
Thoughts?
The text was updated successfully, but these errors were encountered: