Repository navigation
Block Editor: Explore naming where each style comes from in the block inspector - #83543
JosVelasco wants to merge 1 commit into
Conversation
Behind the gutenberg-global-styles-inheritance-ui experiment, each block support panel in the block inspector gets an info button before its options menu. It shows a line under every control saying where the value comes from (the theme, the site's Styles, a parent block, the block itself, or custom CSS) and one place to change it, linked to the Styles screen that defines it. - Trace inherited values through the Global Styles layers, the site's Styles changes, and the parent blocks for properties that inherit. - Name custom CSS that also sets the property. - Describe each control by its origin line with aria-describedby, and announce the new origin after a reset. - Show the line under the palette in color pickers. - Remove the reset dots and the props that placed them. - Update the experiment's description. See WordPress#82546.
🤖 PR meta 🤖🏷️ LabelsThis pull request needs exactly one label indicating its type, and has 0.
Read more about Type labels in Gutenberg. If you cannot add labels yourself, a reviewer can do it for you. |
|
Hi @annezazu and @fcoveram! Following your feedback on #83472, I tried a new approach that keeps the information next to the controls. Each panel gets an info button, and every setting shows where its value comes from and where to change it. There's a video in the description. I'd love to hear what you think! |
|
Thanks @JosVelasco for keeping trying ideas. I like the idea of moving the origin closer to the control, but this version adds a lot of help text that overloads the inspector. Based on other designs that explored adding actions inside the controls, those designs introduced new issues by breaking other component requirements. I'm optimistic about the latest design in #82546 as it introduces a small change and allows us to test and see what users expect to see and how they might interact with it. |
|
Thanks @fcoveram! To keep the conversation going, I put together a quick mockup that follows your design. It isn't code, just a way to picture it. The idea, simply:
The screenshots: A heading. Its color comes from the Heading block styles, and its size from the Heading element: A paragraph inside a Group. Its color comes from the Group it's in, which is why the canvas shows a color the paragraph never set: A heading with the Display style. Its size comes from the "Display" block style variation: What do you think? |
|
Looking this over, the biggest difference I see is an information icon over a diamond icon per the latest designs here along with the icon being visible for each individual style change. This is far too cluttered as is:
Right now, let's focus and gather around the latest designs shared here. I like the consolidated approach (one place to see all changes) but am not sold on the diamond per usual ;) |




Important note
This is an exploration for #82546, opened as a draft. It follows the feedback on #83453 and #83472 and is not proposed for merge as-is (see Known gaps). Everything is behind the
gutenberg-global-styles-inheritance-uiexperiment. Take it over, cherry-pick from it, or close it.Video
where-styles-toggle.mp4
What?
See #82546.
Each block support panel in the block inspector (Typography, Color, Background, Dimensions, Border, Filters) gets an info button in its header, just before the options menu. It shows a line under every control in the panel saying where that value comes from:
The Styles trail links to that Styles screen in the Site Editor (same tab), and it is also written out, so the screen can be found without the link. The parent block's name selects that block. Under Advanced → Additional CSS, a line names site CSS that also applies to the block.
The line also shows, and is announced to screen readers, right after a value is reset, to say what the control fell back to. Color controls show the line under the palette in their picker.
The blue reset dots are removed: a value set on the block now reads "Set on this block.", and resets from the panel's options menu or the control's own Reset, as without the experiment.
Why?
The explorations in #83453 (List View) and #83472 (a popover on the block) showed where a style comes from on a separate surface. annezazu and fcoveram both found that disconnected from the controls, and fcoveram asked for the information next to the controls, with a way to act on it.
This version puts the origin under each control, and turns every line into a pointer to act on: change it here for this block, or in the named Styles screen for everything it applies to. The lines stay hidden until asked for, so the panels look the same as today at rest, and once turned on for a panel the info button stays on while moving between blocks, to compare them.
How?
useResolvedStylealready resolves the Root, element, block and block style variation layers withresolveStyle, which records the layer that supplies each leaf. The block support hooks now share that result (plus the block, variation and element layers it was resolved against) throughInheritanceSourceContext, and each control passes the Global Styles path it edits (inheritancePath).globalStylesUserDataKey), so a value that is present there reads as "Set in the site's Styles", otherwise "Set by the theme".getStylesSectionmaps the layer and path to a Styles screen (/typography/heading,/blocks/core%2Fheading,/typography/text, …), andgetStylesCrumbnames it the way its menus read. The editor passes a link builder (styleOriginUrlKey) only for block themes and users who can edit Global Styles;block-editorstays WordPress-agnostic.cssSetsPropertychecks the block's Additional CSS, the block type's CSS in Styles, and site-wide custom CSS rules that name the block's class, for the CSS property each path sets.BlockSupportToolsPaneladds a container to theToolsPanelheader before the options menu, so the reading and tab order match what is shown, and renders the button into it with a portal. It setsis-showing-style-originson the panel; the lines expand with a grid-row transition (none with reduced motion).aria-describedby, so screen readers read the origin even while the line is hidden. The button usesaria-pressed. A reset announces the new origin withspeak().Testing Instructions
gutenberg-global-styles-inheritance-ui) under Gutenberg → Experiments.font-size: 2.5rem !important;.Testing Instructions for Keyboard
Known gaps
h2, and does not compare specificity: hence "may override it".Implementation notes
ToolsPanelhas no way to add an action to its header, soBlockSupportToolsPaneladds a container to the header's markup and renders the button into it. A header actions prop onToolsPanelwould make this a supported part of the component.aria-describedbyfrom the panel item, kept up to date with aMutationObserver. Each control accepting a description id would be the cleaner path.Related
Use of AI Tools
🤖 Generated with Claude Code