Skip to content

Block Inspector: Display inherited Global Styles breadcrumbs via label tooltip#80150

Closed
aaronrobertshaw wants to merge 1 commit into
update/global-styles-in-inspector-controlsfrom
add/inheritance-label-tooltips
Closed

Block Inspector: Display inherited Global Styles breadcrumbs via label tooltip#80150
aaronrobertshaw wants to merge 1 commit into
update/global-styles-in-inspector-controlsfrom
add/inheritance-label-tooltips

Conversation

@aaronrobertshaw

Copy link
Copy Markdown
Contributor

What?

Follow up to #77894.

Adds a way to render an adornment and tooltip around a control's label, so the block inspector can show where an inherited Global Styles value comes from via a breadcrumb path (e.g. Styles > Mobile > Paragraph > Variation).

Why?

#77894 lands the display of inherited Global Styles values but stops short of the "inherited from…" tooltip. There was no supported way to attach an adornment or tooltip to a control label without reaching into the DOM.

This gives BaseControl, InputControl, and UnitControl a proper API for it.

How?

  • Adds an optional prop to the affected components to render an adornment next to the label.
  • Wires the inherited style source data through to build the breadcrumb tooltip.

Alternative Solutions

An earlier exploration injected the adornment and tooltip into existing control labels via createPortal. It was always a hack aimed at avoiding updates to the public API of commonly used components. That PR (#79992) has been closed in favour of this approach.

Testing Instructions

  1. Apply Global Styles to a block and open the inspector.
  2. Confirm inherited controls show the dotted underline and, on hover, a tooltip with the inheritance breadcrumb path.
  3. Confirm the breadcrumb matches where the value actually comes from (root, block type, variation, state, viewport).

Screenshots or screencast

Before After
Screenshot 2026-07-12 at 4 46 02 pm Screenshot 2026-07-12 at 4 44 53 pm

…l tooltip

Show, on each inspector control that renders a value inherited from Global
Styles, a breadcrumb tooltip pointing at the style path the value is inherited
from.

Components: add an optional `labelTooltip` string prop that wraps the visible
label text in the @wordpress/ui Tooltip via a shared LabelWithTooltip helper.
It is threaded through the label primitives (BaseControl,
BaseControl.VisualLabel, InputControl) and the mid-level components
(Unit/Number/Select/Range/ToggleGroupControl, FontSizePicker, BoxControl,
CustomSelectControl v1+v2). The tooltip renders one breadcrumb segment per
line.

Block editor: each Global Styles panel resolves a control's inheritance once
through a small getControlInheritance helper that returns both the
InheritanceToolsPanelItem props and the breadcrumb labelTooltip, so the
'inherited at rest' gate lives in one place and the item props and tooltip
can't drift. The three custom-label controls (color name, background image
title, duotone) wrap their own labels with a matching InheritanceLabelTooltip.
InheritanceToolsPanelItem no longer touches the tooltip — it only applies the
inherited className treatment and the local-override reset dot. No portals,
MutationObserver, or cloneElement.
@aaronrobertshaw aaronrobertshaw self-assigned this Jul 12, 2026
@aaronrobertshaw aaronrobertshaw added [Type] Enhancement A suggestion for improvement. Global Styles Anything related to the broader Global Styles efforts, including Styles Engine and theme.json [Feature] Design Tools Tools that impact the appearance of blocks both to expand the number of tools and improve the experi labels Jul 12, 2026
@github-actions github-actions Bot added [Package] Components /packages/components [Package] Block editor /packages/block-editor labels Jul 12, 2026
@github-actions

Copy link
Copy Markdown

Size Change: +29.2 kB (+0.38%)

Total Size: 7.71 MB

📦 View Changed
Filename Size Change
build/scripts/block-editor/index.min.js 423 kB +1.61 kB (+0.38%)
build/scripts/components/index.min.js 297 kB +27.4 kB (+10.15%) ⚠️
build/styles/block-editor/style-rtl.css 19.8 kB +56 B (+0.28%)
build/styles/block-editor/style-rtl.min.css 16.9 kB +36 B (+0.21%)
build/styles/block-editor/style.css 19.9 kB +54 B (+0.27%)
build/styles/block-editor/style.min.css 16.9 kB +37 B (+0.22%)

compressed-size-action

@mirka

mirka commented Jul 13, 2026

Copy link
Copy Markdown
Member

Thanks for the demo.

This type of thing has been requested before, but there are blockers to making it a proper pattern. The main one being that the information is unavailable on touch devices. In this specific case on label elements, the information is also unavailable for keyboard users, unless we further modify the labels to actually be button elements that trigger the popup. (We have a guidance doc on tooltip usage and alternatives.)

My suggestion to consider the details pattern is not saying that we can implement this tooltip design as is with the details prop. Rather it's asking whether we can rethink the design of how to surface this inheritance information, so it doesn't require a hyper-specific extension point that has limited application due to accessibility constraints. One possibility that comes to mind is some kind of "Inherited" button below the control that triggers open an infotip with the inheritance path. That would also function as a more obvious indicator that the field is inherited.

@aaronrobertshaw aaronrobertshaw changed the title Block Inspector: Display inherited Global Styles breadcrumbs via labe… Block Inspector: Display inherited Global Styles breadcrumbs via label tooltip Jul 13, 2026
@aaronrobertshaw

Copy link
Copy Markdown
Contributor Author

Thanks for the response @mirka 👍

My plan for the controls in the block inspector was to add a visually hidden text element for screen readers to be given the information while satisfying the design.

I appreciate the suggestion to re-think the design. I don't believe we have the real estate below every single control in the block inspector to go adding a button there. We could look to achieve similar to the local override reset button that is conditionally added and absolutely positioned for every control.

Even that though is a bit of a fudge to work around growing difficulty to work with and update our components to achieve the desired UX. It is somewhat brittle and unintuitive as well.

@aaronrobertshaw

Copy link
Copy Markdown
Contributor Author

Also, am I correct in thinking we only have one or two controls (InputControl, SelectControl etc) migrated across to @wordpress/ui where the details pattern would even be available? So we're a long way from being able to achieve that approach?

@aaronrobertshaw

Copy link
Copy Markdown
Contributor Author

I'll close this PR for now.

It is worth noting that updating our components to support this need was flagged as something the components "should handle".

Inheritance, resets are important parts of handling styles so I think our base UI components should have coherent props to handle these

At this stage, we don't, whether that is new props or the details pattern.

I'll update the issue noting that display of where styles come from will be punted from 7.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Feature] Design Tools Tools that impact the appearance of blocks both to expand the number of tools and improve the experi Global Styles Anything related to the broader Global Styles efforts, including Styles Engine and theme.json [Package] Block editor /packages/block-editor [Package] Components /packages/components [Type] Enhancement A suggestion for improvement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants