Skip to content

Block Styles: Show the active style variation in forced colors mode - #86378

Merged
mirka merged 3 commits into
trunkfrom
fix/block-styles-forced-colors-active-style
Nov 6, 2026
Merged

mirka merged 3 commits into
trunkfrom
fix/block-styles-forced-colors-active-style

Conversation

@mirka

@mirka mirka commented Nov 5, 2026

Copy link
Copy Markdown
Member

What?

Follow-up to #85948.

Shows which style variation is active in the block inspector when forced colors mode is on.

Why?

The active style variation is marked only by a solid background, and forced colors mode discards it, so the active button looks the same as the others. #85948 does not reach these buttons, because they switch between the solid and outline variants and have no pressed state.

How?

The fix is local to this control and not in Button, because solid only means "selected" here. The active style uses the same system selection colors as the pressed Button in #85948, so the two selection states match in forced colors mode.

Testing Instructions

  1. Open a post, add a Separator block, and open the Styles panel in the block inspector.
  2. In Chrome DevTools, open Rendering and set "Emulate CSS media feature forced-colors" to active.
  3. Confirm the active style is filled with the selection color, its label is readable, and the other styles stay outlined.
  4. Select another style and confirm the fill moves to it.
  5. Set "Emulate CSS media feature prefers-color-scheme" to dark and confirm the active style is still filled and readable.
  6. Turn off forced colors emulation and confirm the buttons look unchanged.

Testing Instructions for Keyboard

  1. With forced colors emulation active, press Tab until the active style has focus.
  2. Press the arrow keys to change the style.
  3. Confirm the newly active style is filled and has a visible focus ring.

Screenshots or screencast

Before After
Forced colors Forced colors before: the active Default style is outlined like the others Forced colors after: the active Default style is filled with the selection color
Forced colors, dark Dark forced colors before: the active Default style is outlined like the others Dark forced colors after: the active Default style is filled with the selection color
Forced colors, active style focused Forced colors after: the focused active Dots style has a visible focus ring and its tooltip is open
Normal colors (unchanged) Normal colors before Normal colors after, identical to before

@mirka mirka added [Type] Bug An existing feature does not function as intended Backport to WP 7.2 Beta/RC Pull request that needs to be backported to the WordPress major release that's currently in beta labels Nov 5, 2026
@mirka mirka self-assigned this Nov 5, 2026
@github-actions github-actions Bot added the [Package] Block editor /packages/block-editor label Nov 5, 2026
@github-actions

github-actions Bot commented Nov 5, 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: mirka <0mirka00@git.wordpress.org>
Co-authored-by: t-hamano <wildworks@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: +329 B (0%)

Total Size: 8.61 MB

📦 View Changed
Filename Size Change
build/styles/block-editor/style-rtl.css 20.1 kB +77 B (+0.39%)
build/styles/block-editor/style-rtl.min.css 17.1 kB +87 B (+0.51%)
build/styles/block-editor/style.css 20.1 kB +77 B (+0.38%)
build/styles/block-editor/style.min.css 17.1 kB +88 B (+0.52%)

7cc2b87 Run

⚡ Performance

Show the results

Client side metrics exclude the server response time.

front-end-block-theme

Metric f60abca trunk % Change
timeToFirstByte 58.5 ms +11.03% -3.25% 55.75 ms +6.01% -4.22% 4.93%
largestContentfulPaint 96 ms +8.33% -4.17% 96 ms +4.17% -8.33% 0%
lcpMinusTtfb 35.55 ms +11.25% -4.5% 37.5 ms +14.8% -11.6% -5.2%
wpBeforeTemplate 30.75 ms +12.2% -3.12% 29.34 ms +9.51% -2.83% 4.81%
wpTemplate 23.06 ms +4.51% -1.91% 22.24 ms +2.34% -4.14% 3.69%
wpTotal 54.47 ms +10.48% -3.4% 51.58 ms +6.98% -3.82% 5.6%
wpMemoryUsage 7.72 MB +0% -0% 7.68 MB +0% -0% 0.43%
wpDbQueries 16 +0% -0% 16 +0% -0% 0%

front-end-classic-theme

Metric f60abca trunk % Change
timeToFirstByte 46.75 ms +9.2% -1.18% 46.15 ms +7.8% -1.3% 1.3%
largestContentfulPaint 102 ms +1.96% -1.96% 100 ms +4% -0% 2%
lcpMinusTtfb 54.2 ms +5.26% -0.92% 53.95 ms +1.3% -1.67% 0.46%
wpBeforeTemplate 27.13 ms +6.16% -2.8% 26.56 ms +1.51% -1.47% 2.15%
wpTemplate 16.69 ms +5.45% -2.34% 16.59 ms +3.44% -2.47% 0.6%
wpTotal 43.59 ms +9.73% -1.28% 42.91 ms +8.37% -0.84% 1.58%
wpMemoryUsage 6.41 MB +0% -0% 6.37 MB +0% -0% 0.53%
wpDbQueries 13 +0% -0% 13 +0% -0% 0%

media-processing

Metric f60abca trunk % Change
mediaProcessingJpeg 406.9 ms +0.6% -1.14% 408.21 ms +0.55% -1.22% -0.32%
mediaProcessingAvif 6202.45 ms +0.4% -0.39% 6178.76 ms +0.59% -0.4% 0.38%
mediaProcessingJpegToAvif 4280.37 ms +0.09% -0.34% 4263.6 ms +0.25% -0.29% 0.39%

media-upload

Metric f60abca trunk % Change
jpegUploadProcessing 1960.5 ms +1.93% -0.85% 1946.23 ms +0.61% -1.19% 0.73%
pngUploadProcessing 174.61 ms +59.17% -8.58% 176.36 ms +9.2% -8.92% -0.99%
largeJpegUploadProcessing 1949.06 ms +0.11% -0.18% 1956.32 ms +0.47% -1.17% -0.37%
multipleImageUploadProcessing 2038.69 ms +0.63% -0.19% 2034.81 ms +1.23% -0.29% 0.19%

post-editor

Metric f60abca trunk % Change
serverResponse 485.23 ms +5.35% -7.09% 481.32 ms +3.57% -7.92% 0.81%
firstPaint 389.1 ms +24.2% -22.91% 448.41 ms +14.82% -19.11% -13.23%
domContentLoaded 886.25 ms +6.5% -1.44% 870.6 ms +0.79% -1.2% 1.8%
loaded 887.36 ms +6.5% -1.45% 871.72 ms +0.79% -1.18% 1.79%
firstContentfulPaint 524.26 ms +13.51% -2.75% 513.81 ms +1.35% -2.92% 2.03%
firstBlock 2274.36 ms +2.63% -1.02% 2227.85 ms +1.28% -0.72% 2.09%
type 18.56 ms +13.2% -9.21% 18.24 ms +10.42% -7.13% 1.75%
typeWithoutInspector 18.07 ms +4.65% -9.46% 18.78 ms +5.27% -13.79% -3.78%
typeWithTopToolbar 23.37 ms +14.38% -6.12% 24.22 ms +4.17% -5.33% -3.51%
typeContainer 8.39 ms +13.35% -3.93% 8.59 ms +15.25% -5.7% -2.33%
focus 124.55 ms +3.71% -2.14% 118.63 ms +6.48% -3.61% 4.99%
firstFocus 262.55 ms +0% -0% 262.78 ms +0% -0% -0.09%
selectAll 407.87 ms +3.54% -2.96% 430.38 ms +0.65% -8.62% -5.23%
undo 29.58 ms +4.67% -2.37% 30.92 ms +1.58% -6.37% -4.33%
listViewOpen 81.76 ms +8.65% -6.46% 77.01 ms +9.71% -7.28% 6.17%
inserterOpen 41.19 ms +2.16% -6.55% 42.42 ms +14.4% -10.94% -2.9%
inserterHover 11.24 ms +9.16% -8.81% 11.46 ms +8.9% -7.85% -1.92%
inserterSearch 8.97 ms +4.24% -7.02% 8.88 ms +2.03% -2.48% 1.01%
loadPatterns 646.5 ms +4.25% -6.52% 647.49 ms +2.35% -3.41% -0.15%
wpTotal 475.59 ms +5.2% -7.27% 471.62 ms +3.33% -8.09% 0.84%
wpMemoryUsage 14.76 MB +0% -0% 14.73 MB +0% -0% 0.24%
wpDbQueries 55 +0% -0% 55 +0% -0% 0%

site-editor

Metric f60abca trunk % Change
serverResponse 264.83 ms +3.46% -3.15% 232.65 ms +9.96% -3.31% 13.83%
firstPaint 264.42 ms +15.91% -4.68% 242.26 ms +29.73% -6.96% 9.15%
domContentLoaded 635.76 ms +6.54% -4.13% 550.58 ms +2.15% -2.46% 15.47%
loaded 636.65 ms +6.55% -4.15% 551.18 ms +2.16% -2.41% 15.51%
firstContentfulPaint 385.57 ms +4.5% -8.91% 328.97 ms +1.48% -0.44% 17.21%
firstBlock 1805.12 ms +5.22% -3.9% 1633.2 ms +1.24% -2.43% 10.53%
type 13.98 ms +3.79% -8.44% 11.75 ms +4.17% -12.85% 18.98%
navigate 89.68 ms +7.73% -10.28% 74.39 ms +4.68% -7.72% 20.55%
loadPatterns 919.1 ms +16.69% -5.98% 802.07 ms +1.6% -6.85% 14.59%
loadPages 952.12 ms +1.87% -1.89% 923.64 ms +3.73% -1.28% 3.08%
wpTotal 258.28 ms +3.5% -3.44% 226.32 ms +10.13% -3.46% 14.12%
wpMemoryUsage 12.78 MB +0% -0% 12.74 MB +0% -0% 0.27%
wpDbQueries 45 +0% -0% 45 +0% -0% 0%

7cc2b87 Run

🏁 Flaky tests

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.

Undo restores the post selection when another synced entity is loaded (RTC WebSocket) in /test/e2e/specs/editor/collaboration/collaboration-undo-redo.spec.ts, passed after 1 failed attempt.
Error: expect(received).toMatchObject(expected)

- Expected  - 2
+ Received  + 2

  Object {
    "attributeKey": "content",
    "blockIndex": 0,
    "content": "abcdef",
-   "endOffset": 3,
-   "offset": 3,
+   "endOffset": 6,
+   "offset": 6,
  }

Call Log:
- Timeout 5000ms exceeded while waiting on the predicate
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/collaboration/collaboration-undo-redo.spec.ts:363:5
Undo restores the post selection when another synced entity is loaded in /test/e2e/specs/editor/collaboration/collaboration-undo-redo.spec.ts, passed after 1 failed attempt.
Error: expect(received).toMatchObject(expected)

- Expected  - 2
+ Received  + 2

  Object {
    "attributeKey": "content",
    "blockIndex": 0,
    "content": "abcdef",
-   "endOffset": 3,
-   "offset": 3,
+   "endOffset": 6,
+   "offset": 6,
  }

Call Log:
- Timeout 5000ms exceeded while waiting on the predicate
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/collaboration/collaboration-undo-redo.spec.ts:363:5

7cc2b87 Run

# Conflicts:
#	packages/block-editor/CHANGELOG.md
@mirka
mirka marked this pull request as ready for review November 6, 2026 05:59
@mirka
mirka requested a review from ellatrix as a code owner November 6, 2026 05:59
@mirka
mirka requested a review from a team November 6, 2026 05:59

@t-hamano t-hamano 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.

LGTM! It's unfortunate that the current UI isn't ideal and requires a local override, but I think this approach is fine for now.

@mirka
mirka merged commit 653a734 into trunk Nov 6, 2026
97 checks passed
@mirka
mirka deleted the fix/block-styles-forced-colors-active-style branch November 6, 2026 15:05
@github-actions github-actions Bot added this to the Gutenberg 24.5 milestone Nov 6, 2026
@github-actions

github-actions Bot commented Nov 6, 2026

Copy link
Copy Markdown

There was a conflict while trying to cherry-pick the commit to the wp/7.2 branch. Please resolve the conflict manually and create a PR to the wp/7.2 branch.

PRs to wp/7.2 are similar to PRs to trunk, but you should base your PR on the wp/7.2 branch instead of trunk.

# Checkout the wp/7.2 branch instead of trunk.
git checkout wp/7.2

# Create a new branch for your PR.
git checkout -b my-branch

# Cherry-pick the commit.
git cherry-pick 653a7345276d06f761368c179e99c6ac4bd9bd10

# Check which files have conflicts.
git status

# Resolve the conflict...
# Add the resolved files to the staging area.
git status
git add .
git cherry-pick --continue

# Push the branch to the repository
git push origin my-branch

# Create a PR and set the base to the wp/7.2 branch.
# See https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/changing-the-base-branch-of-a-pull-request.

mirka added a commit that referenced this pull request Nov 6, 2026
…rs mode (#86450)

* Block Styles: Show the active style variation in forced colors mode (#86378)

* Block Styles: Show the active style variation in forced colors mode

* Add PR link to changelog entry

Co-authored-by: mirka <0mirka00@git.wordpress.org>
Co-authored-by: t-hamano <wildworks@git.wordpress.org>
(cherry picked from commit 653a734)

* Add changelog link

---------

Co-authored-by: t-hamano <wildworks@git.wordpress.org>
@mirka mirka added Backported to WP Core Pull request that has been successfully merged into WP Core and removed Backport to WP 7.2 Beta/RC Pull request that needs to be backported to the WordPress major release that's currently in beta labels Nov 6, 2026
Vedant-Gandhi pushed a commit to Vedant-Gandhi/gutenberg that referenced this pull request Nov 30, 2026
…ordPress#86378)

* Block Styles: Show the active style variation in forced colors mode

* Add PR link to changelog entry

Co-authored-by: mirka <0mirka00@git.wordpress.org>
Co-authored-by: t-hamano <wildworks@git.wordpress.org>
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 [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