Skip to content

List View: Keep selected labels, badges and focus rings readable - #87177

Merged
ciampo merged 10 commits into
trunkfrom
codex/list-view-selection-contrast
Nov 25, 2026
Merged

ciampo merged 10 commits into
trunkfrom
codex/list-view-selection-contrast

Conversation

@ciampo

@ciampo ciampo commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Split from #86614.

What?

Keep selected block labels, HTML anchor badges and action focus rings readable in List View. This also covers selected links in the Site Editor's Navigation sidebar.

Why?

On trunk, a light brand color can leave a selected heading with white text on yellow. With a primary color of #ffdf57, the heading's text contrast improves from 1.32:1 to 12.66:1.

How?

Use the theme's brand foreground and background together. Swap them for the anchor badge and use the row's text color for the inset focus ring. Synced rows keep their purple fill and white text. Standalone editors without design tokens get dark badge text on white.

Contrast between the row fill and the surrounding surface is tracked in #86614. For the dark surface #252525 and primary color #1c7c64, it drops from just over 3:1 on trunk to 2.72:1 here. The companion branch raises it to 3.31:1.

Testing Instructions

  1. In the post editor, add a Heading with the text Chapter one. Under Advanced → HTML anchor, enter chapter-one.
  2. Open List View and select the heading. Check that you can read the block name and anchor, and that the badge stands out from the selected row.
  3. Choose Fresh under Users → Profile → Admin Color Scheme. In Appearance → Editor → Navigation, select a menu link and hover it. Its label and icon should use the selected row's foreground.
Reproduce the light brand color in a plugin sidebar

With the test post open, run this in the browser console. Select the heading in the new sidebar. Reload the editor to remove the preview.

wp.plugins.registerPlugin( 'list-view-color-preview', {
	render: () => wp.element.createElement(
		wp.editor.PluginSidebar,
		{ name: 'preview', title: 'List View' },
		wp.element.createElement(
			wp.theme.ThemeProvider,
			{ color: { primary: '#ffdf57' } },
			wp.element.createElement( wp.blockEditor.__experimentalListView )
		)
	),
} );
wp.data.dispatch( 'core/edit-post' ).openGeneralSidebar( 'list-view-color-preview/preview' );

Testing Instructions for Keyboard

With List View closed and the heading selected, press Control+Option+O on macOS or Alt+Shift+O on Windows or Linux. From the heading row, press Right Arrow to focus Options and check its inset ring. Repeat with a synced pattern. If a plugin enables showBlockMovers, check the Move buttons as well.

Screenshots or screencast

Plugin sidebar with a light brand color

Before After
White heading text and a muted anchor badge on a yellow selected row Dark heading text and a dark anchor badge on the same yellow row

Site Editor navigation with the Fresh admin color scheme

Hovering the selected link now gives its text 4.59:1 contrast, up from 4.01:1.

Before After
The selected About link has pale text on blue when hovered The hovered About link has black text on the same blue selection
Post editor List View in five admin color schemes

The same heading is selected with keyboard focus on Options.

Default (Modern)

Before After
Selected heading with a darkened anchor badge in the Default (Modern) scheme Selected heading with an inverted anchor badge in the Default (Modern) scheme

Fresh

Before After
Selected heading with a darkened anchor badge in the Fresh scheme Selected heading with an inverted anchor badge in the Fresh scheme

Midnight

Before After
Selected heading with a darkened anchor badge in the Midnight scheme Selected heading with an inverted anchor badge in the Midnight scheme

Ocean

Before After
Selected heading with a darkened anchor badge in the Ocean scheme Selected heading with an inverted anchor badge in the Ocean scheme

Sunrise

Before After
Selected heading with a darkened anchor badge in the Sunrise scheme Selected heading with an inverted anchor badge in the Sunrise scheme

Use of AI Tools

Codex and Claude helped implement the changes. Codex ran the independent reviews, tested the editor and captured the screenshots.

@github-actions github-actions Bot added [Package] Block editor /packages/block-editor [Package] Edit Site /packages/edit-site labels Nov 20, 2026
@github-actions

github-actions Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

🤖 PR meta 🤖

Preview in WordPress Playground Preview in Storybook

🎉 Props

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: ciampo <mciampini@git.wordpress.org>
Co-authored-by: andrewserong <andrewserong@git.wordpress.org>

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


Props Bot commands

You can trigger Props Bot actions by commenting on this PR:

  • @propsbot add <username> to give props to a GitHub user. Requires write access.
  • @propsbot remove <username> to leave a user out of the props. Requires write access.
  • @propsbot refresh to refresh this list. Adding the props-bot label works too.

Updated as activity occurs, without notifying anyone named here. Add the props-bot label to refresh.

📦 Bundle size

Size Change: +445 B (+0.01%)

Total Size: 8.72 MB

📦 View Changed
Filename Size Change
build/styles/block-editor/style-rtl.css 20.3 kB +150 B (+0.74%)
build/styles/block-editor/style-rtl.min.css 17.2 kB +57 B (+0.33%)
build/styles/block-editor/style.css 20.3 kB +148 B (+0.73%)
build/styles/block-editor/style.min.css 17.2 kB +58 B (+0.34%)
build/styles/edit-site/style-rtl.css 21.3 kB +10 B (+0.05%)
build/styles/edit-site/style-rtl.min.css 17.2 kB +6 B (+0.03%)
build/styles/edit-site/style.css 21.3 kB +10 B (+0.05%)
build/styles/edit-site/style.min.css 17.2 kB +6 B (+0.03%)

e5333f3 Run

⚡ Performance

Show the results

Client side metrics exclude the server response time.

front-end-block-theme

Metric 62a44e7 trunk % Change
timeToFirstByte 46.2 ms +12.45% -5.63% 44.45 ms +6.86% -6.07% 3.94%
largestContentfulPaint 74 ms +2.7% -5.41% 72 ms +5.56% -8.33% 2.78%
lcpMinusTtfb 25.45 ms +20.63% -5.3% 25.15 ms +22.86% -7.95% 1.19%
wpBeforeTemplate 23.26 ms +11.01% -3.22% 22.56 ms +7.54% -4.79% 3.1%
wpTemplate 18.26 ms +10.08% -4.27% 17.71 ms +4.86% -5.42% 3.11%
wpTotal 42.71 ms +12.25% -6.11% 41.01 ms +7.22% -6.9% 4.15%
wpMemoryUsage 7.75 MB +0% -0% 7.72 MB +0% -0% 0.45%
wpDbQueries 16 +0% -0% 16 +0% -0% 0%

front-end-classic-theme

Metric 62a44e7 trunk % Change
timeToFirstByte 36.15 ms +8.02% -4.15% 35.75 ms +6.99% -1.82% 1.12%
largestContentfulPaint 64 ms +9.38% -0% 64 ms +6.25% -0% 0%
lcpMinusTtfb 29.4 ms +1.7% -3.57% 28.9 ms +3.11% -2.94% 1.73%
wpBeforeTemplate 19.51 ms +9.79% -1.44% 19.41 ms +9.02% -1.96% 0.52%
wpTemplate 13.08 ms +9.25% -3.06% 13.2 ms +4.24% -4.02% -0.91%
wpTotal 32.92 ms +9.87% -2.83% 33.04 ms +7.45% -3.18% -0.36%
wpMemoryUsage 6.44 MB +0% -0% 6.41 MB +0% -0% 0.56%
wpDbQueries 13 +0% -0% 13 +0% -0% 0%

media-processing

Metric 62a44e7 trunk % Change
mediaProcessingJpeg 324.33 ms +1.62% -0.48% 328.23 ms +4.65% -1.13% -1.19%
mediaProcessingAvif 4877.93 ms +0.29% -0.25% 4856.23 ms +0.23% -0.14% 0.45%
mediaProcessingJpegToAvif 3417.18 ms +1.13% -0.08% 3404.75 ms +0.11% -0.55% 0.37%

media-upload

Metric 62a44e7 trunk % Change
jpegUploadProcessing 1462.26 ms +1.74% -0.54% 1450.42 ms +1.59% -0.29% 0.82%
pngUploadProcessing 246.43 ms +4.44% -7.49% 232.85 ms +12.63% -6.06% 5.83%
largeJpegUploadProcessing 1445.05 ms +0.18% -0.97% 1444.64 ms +0.85% -0.96% 0.03%
multipleImageUploadProcessing 1539.72 ms +0.82% -2.68% 1576.13 ms +0.38% -3.59% -2.31%

post-editor

Metric 62a44e7 trunk % Change
serverResponse 400.58 ms +4.71% -8.92% 397.47 ms +1.06% -6.62% 0.78%
firstPaint 425.75 ms +8.84% -3.38% 414.78 ms +4.2% -4.99% 2.64%
domContentLoaded 798.23 ms +4.27% -1.21% 774.48 ms +2.93% -0.32% 3.07%
loaded 799.35 ms +4.25% -1.21% 775.7 ms +2.91% -0.36% 3.05%
firstContentfulPaint 454.51 ms +6.24% -1.87% 436.42 ms +3.77% -1.46% 4.15%
firstBlock 2074 ms +2.89% -1.3% 2031.21 ms +0.79% -0.64% 2.11%
type 18.09 ms +8.07% -6.97% 16.84 ms +10.99% -6.71% 7.42%
typeWithoutInspector 17.4 ms +6.78% -12.13% 17.12 ms +12.91% -10.16% 1.64%
typeWithTopToolbar 23.15 ms +5.62% -9.03% 23.07 ms +5.07% -11.49% 0.35%
typeContainer 8.07 ms +9.79% -11.9% 8.13 ms +4.67% -11.56% -0.74%
focus 108.66 ms +3.72% -4.79% 105.9 ms +3.53% -4.12% 2.61%
firstFocus 241.37 ms +0% -0% 262.79 ms +0% -0% -8.15%
selectAll 328.48 ms +0.53% -2.06% 312.26 ms +7.08% -2.64% 5.19%
undo 30.07 ms +7.91% -7.22% 29.01 ms +8.62% -5.89% 3.65%
listViewOpen 35.51 ms +13.6% -3.15% 34.22 ms +15.14% -8.24% 3.77%
inserterOpen 39.32 ms +24.75% -1.81% 41.02 ms +5.39% -10.9% -4.14%
inserterHover 11.77 ms +6.2% -4.76% 11.48 ms +10.63% -7.49% 2.53%
inserterSearch 8.84 ms +12.9% -10.63% 8.22 ms +16.18% -1.34% 7.54%
loadPatterns 704.83 ms +2.65% -9.86% 681.27 ms +8.18% -2% 3.46%
wpTotal 390.92 ms +4.39% -9.13% 387.85 ms +1.1% -6.88% 0.79%
wpMemoryUsage 14.81 MB +0% -0% 14.76 MB +0% -0% 0.33%
wpDbQueries 55 +0% -0% 55 +0% -0% 0%

site-editor

Metric 62a44e7 trunk % Change
serverResponse 255.53 ms +4.42% -7.41% 258.7 ms +1.14% -8.32% -1.23%
firstPaint 266.73 ms +4.47% -5.17% 269.6 ms +5.3% -3.73% -1.06%
domContentLoaded 561.93 ms +0.96% -1.32% 556.7 ms +1.49% -0.57% 0.94%
loaded 562.6 ms +0.98% -1.32% 557.38 ms +1.49% -0.58% 0.94%
firstContentfulPaint 317.93 ms +1.91% -0.89% 320.95 ms +4.7% -1.07% -0.94%
firstBlock 1710.42 ms +1.71% -1.12% 1699.54 ms +1.18% -0.63% 0.64%
type 12.55 ms +0.48% -9.4% 12.57 ms +2.31% -9.71% -0.16%
navigate 82.56 ms +10% -3.95% 80.68 ms +11.11% -5.3% 2.33%
loadPatterns 1025.6 ms +2.88% -8.94% 965.49 ms +9% -15.15% 6.23%
loadPages 907.33 ms +1.3% -2.6% 913.62 ms +0.72% -0.95% -0.69%
wpTotal 248.91 ms +4.47% -7.59% 252.12 ms +1.19% -8.62% -1.27%
wpMemoryUsage 12.84 MB +0% -0% 12.80 MB +0% -0% 0.28%
wpDbQueries 45 +0% -0% 45 +0% -0% 0%

e5333f3 Run

@ciampo ciampo self-assigned this Nov 20, 2026
@ciampo ciampo added the [Type] Enhancement A suggestion for improvement. label Nov 20, 2026
@ciampo
ciampo requested a review from a team November 20, 2026 23:05
@ciampo
ciampo marked this pull request as ready for review November 20, 2026 23:05
@ciampo
ciampo requested a review from ellatrix as a code owner November 20, 2026 23:05
@github-actions
github-actions Bot requested a review from aduth November 20, 2026 23:05
@ciampo ciampo added [Type] Bug An existing feature does not function as intended and removed [Type] Enhancement A suggestion for improvement. labels Nov 25, 2026
ciampo and others added 8 commits November 25, 2026 22:11
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The selected row's background now comes from a custom property, so the
synced row no longer needs a more specific forced-colors override.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A neutral surface badge vanishes when a theme's brand fill is close to
that surface. The row's own foreground and background always contrast,
so swapping them keeps the badge distinct on any brand fill.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
List View select buttons never render aria-current, so the selector
cannot match.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@andrewserong andrewserong left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is testing nicely for me so far! Just left a comment about the synced block. And for this bit:

Keep the purple selection and dark badge overlay for synced patterns.

What's the dark badge overlay in synced patterns? Is it the anchor, or something else?

@ciampo
ciampo force-pushed the codex/list-view-selection-contrast branch from 1c4d379 to e5333f3 Compare November 25, 2026 23:03
@ciampo
ciampo requested a review from andrewserong November 25, 2026 23:13
@ciampo

ciampo commented Nov 25, 2026

Copy link
Copy Markdown
Contributor Author

@andrewserong I meant the background of the HTML anchor badge. I updated the PR description to say that selected synced rows keep their purple background and white text.

@andrewserong andrewserong left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Excellent, thanks for confirming @ciampo! This is testing well for me, changes look good, and nice touch adding all the different admin schemes screenshots to the PR description, that helps showcase the contrast improvements nicely 🚀

@ciampo
ciampo merged commit 7a33166 into trunk Nov 25, 2026
96 of 97 checks passed
@ciampo
ciampo deleted the codex/list-view-selection-contrast branch November 25, 2026 23:28
@github-actions github-actions Bot added this to the Gutenberg 24.6 milestone Nov 25, 2026
Vedant-Gandhi pushed a commit to Vedant-Gandhi/gutenberg that referenced this pull request Nov 30, 2026
…dPress#87177)

* List View: Keep selected labels, badges and focus rings readable

* List View: Link the selected row changelog entries

* List View: Mention anchor badges in the changelog entry

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* List View: Drop the synced selector from the forced-colors background

The selected row's background now comes from a custom property, so the
synced row no longer needs a more specific forced-colors override.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* List View: Invert the selected row's colors for the anchor badge

A neutral surface badge vanishes when a theme's brand fill is close to
that surface. The row's own foreground and background always contrast,
so swapping them keeps the badge distinct on any brand fill.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Navigation: Drop the unused aria-current menu link selector

List View select buttons never render aria-current, so the selector
cannot match.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* List View: Read the thumbnail separator from the selected row color

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* List View: Name the replaced color source in the changelog

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* List View: Remove the unused synced anchor badge rule

* List View: Keep anchor badges readable without design tokens

---------

Co-authored-by: ciampo <mciampini@git.wordpress.org>
Co-authored-by: andrewserong <andrewserong@git.wordpress.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Package] Block editor /packages/block-editor [Package] Edit Site /packages/edit-site [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