Skip to content

Global Styles: Resolve link element styles in block inspector controls for blocks that are links - #80607

Merged
andrewserong merged 2 commits into
trunkfrom
add/link-element-inheritance-80438
Jul 23, 2026
Merged

Global Styles: Resolve link element styles in block inspector controls for blocks that are links#80607
andrewserong merged 2 commits into
trunkfrom
add/link-element-inheritance-80438

Conversation

@andrewserong

@andrewserong andrewserong commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Part of:

Follows:

What?

Very similar to #80495 that added the logic to resolve per-heading element styles in block inspector controls, this PR takes the same approach but adds link for those core blocks that are links. As a result the included blocks will now reflect root typography link values set in global styles. I.e. a good example is setting Links > Typography > Appearance in global styles and seeing that the value is now reflected as an inherited value in the block inspector for the blocks included in this PR.

Out of scope for this PR: parent / ancestor blocks that define element styles.

Why?

Without this many of these blocks will show element color hierarchy in the editor but the typography controls display as if nothing is set in global styles. For these blocks that effectively are links, we should do our best to reflect element typography values in the UI.

Note that this only applies to some of the blocks in the linked issue. The purpose here is to iteratively add the behaviour, and these were the simplest ones to implement as they effectively are links. Included blocks:

How?

  • Update the getElementLayers function to also include the list of core blocks that should be treated as links

Testing Instructions

  • First up in global styles go to Typography > Links and set Appearance to something slightly unusual, e.g. Extra Bold Italic in TT5 so that it's obvious

The following Claude-generated table gives an overview of what can be made visible thanks to this PR

Block What our link fold can surface
read-more Text colour + typography
loginout Link colour (passthrough) + typography
post-navigation-link Link colour (passthrough) + typography
post-comments-link Link colour (passthrough) + typography
query-pagination-next / -previous / -numbers typography (no colour control)
comments-pagination-next / -previous / -numbers typography (no colour control)
comment-edit-link Link colour (passthrough) + typography
comment-reply-link Link colour (passthrough) + typography

To test these blocks out, you can do so manually, or use the following markup to add to a post or page for testing.

Test markup that includes the affected blocks
<!-- wp:read-more /-->

<!-- wp:loginout /-->

<!-- wp:post-navigation-link /-->

<!-- wp:post-comments-link /-->

<!-- wp:query {"queryId":0,"query":{"perPage":3,"pages":0,"offset":0,"postType":"post","order":"desc","orderBy":"date","inherit":false}} -->
<div class="wp-block-query"><!-- wp:post-template -->
<!-- wp:post-title {"isLink":true} /-->

<!-- wp:read-more /-->
<!-- /wp:post-template -->

<!-- wp:query-pagination -->
<!-- wp:query-pagination-previous /-->

<!-- wp:query-pagination-numbers /-->

<!-- wp:query-pagination-next /-->
<!-- /wp:query-pagination --></div>
<!-- /wp:query -->

<!-- wp:comments -->
<div class="wp-block-comments"><!-- wp:comment-template -->
<!-- wp:comment-author-name /-->

<!-- wp:comment-content /-->

<!-- wp:comment-reply-link /-->

<!-- wp:comment-edit-link /-->
<!-- /wp:comment-template -->

<!-- wp:comments-pagination -->
<!-- wp:comments-pagination-previous /-->

<!-- wp:comments-pagination-numbers /-->

<!-- wp:comments-pagination-next /-->
<!-- /wp:comments-pagination --></div>
<!-- /wp:comments -->

Screenshots or screencast

On trunk, note that Appearance looks as if it's empty:

image

Whereas in this branch it shows a default value when it's set at the link level in global styles:

image

Use of AI Tools

Claude Code with lots of manual verification

@andrewserong
andrewserong requested a review from ramonjd July 23, 2026 04:54
@andrewserong andrewserong self-assigned this Jul 23, 2026
@andrewserong
andrewserong requested a review from ellatrix as a code owner July 23, 2026 04:54
@andrewserong andrewserong added [Type] Bug An existing feature does not function as intended [Package] Block editor /packages/block-editor 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 Backport to WP 7.1 Beta/RC Pull request that needs to be backported to the WordPress major release that's currently in beta labels Jul 23, 2026
@github-actions

Copy link
Copy Markdown

Size Change: +103 B (0%)

Total Size: 7.75 MB

📦 View Changed
Filename Size Change
build/scripts/block-editor/index.min.js 428 kB +103 B (+0.02%)

compressed-size-action

@github-actions

github-actions Bot commented Jul 23, 2026

Copy link
Copy Markdown

Flaky tests detected in f293b7e.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/29983421767
📝 Reported issues:

@ramonjd ramonjd left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is working great for me, thanks for getting it up!

Before After
Image Image

Only site title wasn't working the way I expected both stand alone and in a query:

Image

It was showing the text fallbacks (but not my link styles)

Not sure how tricky the following blocks are as well: tag-cloud, categories, archives. They contain <a> elements. Potential follow up.

Looking just at tag-cloud, it's server-side generated.

Comment thread packages/block-editor/CHANGELOG.md Outdated
* and the pagination links render `<a>` as their whole selves). Blocks that
* merely *contain* a link — the heading family, Paragraph, Group, and the
* hybrid blocks with a Link colour control (Post Author Name, Post Date, …) —
* get no `link` layer: their inner-link control reads the

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does "get no link layer" mean here. Is it for blocks that have an isLink attribute (and control)?

For post author name, for example: /packages/block-library/src/post-author-name/block.json

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Link "layer" here (the terminology isn't the best) refers to the layering from root to element to block and so on of the styles inheritance. So the goal of this comment is to try to capture that concept here:

I.e. we have a function called getElementLayers that returns a structure of elements that the block can use to resolve the hierarchy. These new additions "get" the link layer, and this comment is attempting to explain why some blocks rely on the inherited pass through of the link element color, whereas some get the explicit treatment here.

Gosh, this is hard to word... I'm not sure if my comment here is more opaque than the nudging I got Claude to do on this JSDoc!

Hope that somehow makes some sense.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, here's a concrete example. Take the "Read more" block — it effectively is a link, so this inheritance allows us to reflect the link color as the text color, whereas for most other blocks, the link color will show up under Elements instead (i.e. for Paragraph):

Image

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You did great. Thanks for the explainer 😄

@github-actions

Copy link
Copy Markdown

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: andrewserong <andrewserong@git.wordpress.org>
Co-authored-by: ramonjd <ramonopoly@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

Co-authored-by: Ramon <ramonjd@users.noreply.github.com>
@andrewserong

Copy link
Copy Markdown
Contributor Author

Only site title wasn't working the way I expected both stand alone and in a query:

Thanks for flagging this, I think this one is hybrid as it can be both a heading and a link, I think I'll leave that to a follow-up exploration if it's okay!

Not sure how tricky the following blocks are as well: tag-cloud, categories, archives. They contain elements. Potential follow up.
Looking just at tag-cloud, it's server-side generated.

Good catches — I might leave these for follow-ups, too, and jot down any notes in the linked issue 👍

@ramonjd

ramonjd commented Jul 23, 2026

Copy link
Copy Markdown
Member

I think this one is hybrid as it can be both a heading and a link, I think I'll leave that to a follow-up exploration

Sounds good!

@andrewserong
andrewserong merged commit d45ca55 into trunk Jul 23, 2026
48 of 51 checks passed
@andrewserong
andrewserong deleted the add/link-element-inheritance-80438 branch July 23, 2026 07:02
@github-actions github-actions Bot added this to the Gutenberg 23.7 milestone Jul 23, 2026
@github-actions github-actions Bot removed the Backport to WP 7.1 Beta/RC Pull request that needs to be backported to the WordPress major release that's currently in beta label Jul 23, 2026
gutenbergplugin pushed a commit that referenced this pull request Jul 23, 2026
…s for blocks that are links (#80607)

* Global Styles: Resolve link element styles in block inspector controls for blocks that are links

* Add url to changelog entry

Co-authored-by: Ramon <ramonjd@users.noreply.github.com>

---------

Co-authored-by: andrewserong <andrewserong@git.wordpress.org>
Co-authored-by: ramonjd <ramonopoly@git.wordpress.org>
@github-actions github-actions Bot added the Backported to WP Core Pull request that has been successfully merged into WP Core label Jul 23, 2026
@github-actions

Copy link
Copy Markdown

I just cherry-picked this PR to the wp/7.1 branch to get it included in the next release: ed5daaf

pento pushed a commit to WordPress/wordpress-develop that referenced this pull request Jul 29, 2026
This updates the pinned commit hash of the Gutenberg repository from `4997026b75c922d8a6f77a03d72ed7cad04c7073` to `fd715a6833679d098d9fee84b642f8f1bc27341b`.

A full list of changes included in this commit can be found on GitHub: 
WordPress/gutenberg@4997026...fd715a6

- Update view config API versioning (WordPress/gutenberg#80319)
- Perf Tests: Fix 'Selecting blocks' metric reporting 0 ms (WordPress/gutenberg#80524)
- Notes: Register the inline note format at import time (WordPress/gutenberg#80576)
- Media: Stop forcing crossorigin on IMG tags in media templates (WordPress/gutenberg#80532)
- GradientPicker: select by slug so two presets sharing a gradient keep their identity (WordPress/gutenberg#80554)
- Media Editor: Show a loading state while the cropped file loads (WordPress/gutenberg#80460)
- Remove default paragraph from tab-panel template (WordPress/gutenberg#80565)
- Global Styles: Resolve link element styles in block inspector controls for blocks that are links (WordPress/gutenberg#80607)
- Media REST API: Backport sideload from url path upload size check (WordPress/gutenberg#80659)
- Rich text: remove tabIndex from editable elements again to fix shift+click selection (WordPress/gutenberg#80651)
- Gallery: make dynamic mode conversion a single undo level (WordPress/gutenberg#80665)
- Background image control: Remove duplicated focus ring (WordPress/gutenberg#80671)
- Detach core's note mention kses filter in the baseline strip test (WordPress/gutenberg#80656)
- wp-build: sync the page template preload field list with core-data (WordPress/gutenberg#80648)
- Read the contentEditable attribute in ownsSelection, not isContentEditable (WordPress/gutenberg#80549)
- Writing flow: extend block selections with shift+arrow when there is no native selection (WordPress/gutenberg#80687)
- Notes: Capture the target block before saving a block-level note (WordPress/gutenberg#80690)
- Theme JSON: Level block-level preset class specificity with :where() (WordPress/gutenberg#80657)
- Notes: Sync the sidebar selection to the inline marker under the caret (WordPress/gutenberg#80610)
- Writing flow: use isMultiSelecting for shift+click (WordPress/gutenberg#80286) (WordPress/gutenberg#80726)
- Block supports: Return from layout support before resolving global settings (WordPress/gutenberg#80771)
- Notes: Report save success consistently from note actions (WordPress/gutenberg#80748)
- Dynamic Gallery: Rename toolbar button to Detach and add a modal explaining what will happen (WordPress/gutenberg#80727) (WordPress/gutenberg#80774)
- ToolsPanel: Migrate styles to an SCSS Module (WordPress/gutenberg#80445) (WordPress/gutenberg#80800)
- Add a responsiveEditingEnabled editor setting to hide the Responsive styles option (WordPress/gutenberg#80814)
- iOS: remove jumping hack, add typewriter (WordPress/gutenberg#74596)
- Writing flow: stop the page scrolling on caret moves within blocks taller than the viewport (WordPress/gutenberg#80708)
- Global Styles: Put the inheritance UI behind a Gutenberg experiment (… (WordPress/gutenberg#80818)
- Notes: Cancel in-flight hover highlight when focus leaves a note thread (WordPress/gutenberg#80752)
- Block Editor: Try to fix typing performance regression (WordPress/gutenberg#80507)
- List Block: Preserve ordered type on indent (WordPress/gutenberg#75353)
- Make editableRoot a private block setting Symbol, not a public support (WordPress/gutenberg#80820)
- Fix cursor position during forward delete of empty blocks (WordPress/gutenberg#80827)
- Navigation: Fixes `aria-expanded` not updating on hover submenu inside overlay (WordPress/gutenberg#80828)
- Remove redundant @jest-environment jsdom pragma and lint against it (WordPress/gutenberg#80676)
- View config: reject shape-mismatched merges, define empty-array semantics, strip nulls from appended members (WordPress/gutenberg#80829)
- Editor: leave undo to the browser in fields that handle their own undo (WordPress/gutenberg#80768)
- Fix: New route-based admin pages are empty when no JS (WordPress/gutenberg#80839)

Props wildworks.
See #65529.

git-svn-id: https://develop.svn.wordpress.org/trunk@62896 602fd350-edb4-49c9-b593-d223f7449a82
markjaquith pushed a commit to markjaquith/WordPress that referenced this pull request Jul 29, 2026
This updates the pinned commit hash of the Gutenberg repository from `4997026b75c922d8a6f77a03d72ed7cad04c7073` to `fd715a6833679d098d9fee84b642f8f1bc27341b`.

A full list of changes included in this commit can be found on GitHub: 
WordPress/gutenberg@4997026...fd715a6

- Update view config API versioning (WordPress/gutenberg#80319)
- Perf Tests: Fix 'Selecting blocks' metric reporting 0 ms (WordPress/gutenberg#80524)
- Notes: Register the inline note format at import time (WordPress/gutenberg#80576)
- Media: Stop forcing crossorigin on IMG tags in media templates (WordPress/gutenberg#80532)
- GradientPicker: select by slug so two presets sharing a gradient keep their identity (WordPress/gutenberg#80554)
- Media Editor: Show a loading state while the cropped file loads (WordPress/gutenberg#80460)
- Remove default paragraph from tab-panel template (WordPress/gutenberg#80565)
- Global Styles: Resolve link element styles in block inspector controls for blocks that are links (WordPress/gutenberg#80607)
- Media REST API: Backport sideload from url path upload size check (WordPress/gutenberg#80659)
- Rich text: remove tabIndex from editable elements again to fix shift+click selection (WordPress/gutenberg#80651)
- Gallery: make dynamic mode conversion a single undo level (WordPress/gutenberg#80665)
- Background image control: Remove duplicated focus ring (WordPress/gutenberg#80671)
- Detach core's note mention kses filter in the baseline strip test (WordPress/gutenberg#80656)
- wp-build: sync the page template preload field list with core-data (WordPress/gutenberg#80648)
- Read the contentEditable attribute in ownsSelection, not isContentEditable (WordPress/gutenberg#80549)
- Writing flow: extend block selections with shift+arrow when there is no native selection (WordPress/gutenberg#80687)
- Notes: Capture the target block before saving a block-level note (WordPress/gutenberg#80690)
- Theme JSON: Level block-level preset class specificity with :where() (WordPress/gutenberg#80657)
- Notes: Sync the sidebar selection to the inline marker under the caret (WordPress/gutenberg#80610)
- Writing flow: use isMultiSelecting for shift+click (WordPress/gutenberg#80286) (WordPress/gutenberg#80726)
- Block supports: Return from layout support before resolving global settings (WordPress/gutenberg#80771)
- Notes: Report save success consistently from note actions (WordPress/gutenberg#80748)
- Dynamic Gallery: Rename toolbar button to Detach and add a modal explaining what will happen (WordPress/gutenberg#80727) (WordPress/gutenberg#80774)
- ToolsPanel: Migrate styles to an SCSS Module (WordPress/gutenberg#80445) (WordPress/gutenberg#80800)
- Add a responsiveEditingEnabled editor setting to hide the Responsive styles option (WordPress/gutenberg#80814)
- iOS: remove jumping hack, add typewriter (WordPress/gutenberg#74596)
- Writing flow: stop the page scrolling on caret moves within blocks taller than the viewport (WordPress/gutenberg#80708)
- Global Styles: Put the inheritance UI behind a Gutenberg experiment (… (WordPress/gutenberg#80818)
- Notes: Cancel in-flight hover highlight when focus leaves a note thread (WordPress/gutenberg#80752)
- Block Editor: Try to fix typing performance regression (WordPress/gutenberg#80507)
- List Block: Preserve ordered type on indent (WordPress/gutenberg#75353)
- Make editableRoot a private block setting Symbol, not a public support (WordPress/gutenberg#80820)
- Fix cursor position during forward delete of empty blocks (WordPress/gutenberg#80827)
- Navigation: Fixes `aria-expanded` not updating on hover submenu inside overlay (WordPress/gutenberg#80828)
- Remove redundant @jest-environment jsdom pragma and lint against it (WordPress/gutenberg#80676)
- View config: reject shape-mismatched merges, define empty-array semantics, strip nulls from appended members (WordPress/gutenberg#80829)
- Editor: leave undo to the browser in fields that handle their own undo (WordPress/gutenberg#80768)
- Fix: New route-based admin pages are empty when no JS (WordPress/gutenberg#80839)

Props wildworks.
See #65529.
Built from https://develop.svn.wordpress.org/trunk@62896


git-svn-id: http://core.svn.wordpress.org/trunk@62163 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Backported to WP Core Pull request that has been successfully merged into WP Core [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 [Type] Bug An existing feature does not function as intended

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants