Skip to content

[WP 7.2] UI: Show keyboard focus on disabled menu items - #85765

Merged
ciampo merged 1 commit into
wp/7.2from
codex/backport-85488-wp-7.2
Oct 28, 2026
Merged

ciampo merged 1 commit into
wp/7.2from
codex/backport-85488-wp-7.2

Conversation

@ciampo

@ciampo ciampo commented Oct 27, 2026

Copy link
Copy Markdown
Contributor

Manual backport of #85488 to wp/7.2.

What?

Show a focus ring on disabled Menu items reached with the keyboard.

Why?

The automatic cherry-pick failed because the release branch's changelog differs from trunk.

How?

Apply the CSS from 21d4f363fded2df864ec520449b7c65e3fcbc21f unchanged. Resolve only the changelog conflict by adding the Menu entry under Unreleased → Bug Fixes, without bringing over unrelated trunk entries.

Testing Instructions

  1. Open Menu Default in Storybook. Open the menu with ArrowDown, then press End. Unavailable action should have a visible focus ring.
  2. Press Enter and Space. The disabled action should remain unavailable. Press Escape and check that focus returns to the trigger.
  3. Open Menu Rich Items, open the menu with ArrowDown, and press ArrowDown again. The disabled Download item should have the same ring, while its label and shortcut retain disabled colors.
  4. Repeat with WordPress global CSS, dark themes, and forced colors.

Testing Instructions for Keyboard

All steps above use the keyboard. Arrow keys should move focus between items, and Escape should return focus to the trigger.

Local verification

The production build, all 60 existing Menu tests, CSS lint, and changelog validation passed. Storybook checks confirmed the focus ring, blocked disabled activation, and focus return in Default, plus the ring in Rich Items with the dark theme and WordPress global CSS. The CSS additions exactly match the original commit.

Screenshots or screencast

See the before/after previews in #85488.

Use of AI Tools

Codex applied the cherry-pick, resolved the changelog conflict, ran verification, and drafted this description.

* Menu: Show focus on disabled UI items

* Fix UI disabled menu focus changelog reference

* Menu: Use highlighted state for disabled item focus rings

---

Co-authored-by: ciampo <mciampini@git.wordpress.org>
Co-authored-by: mirka <0mirka00@git.wordpress.org>
@github-actions github-actions Bot added the [Package] UI /packages/ui label Oct 27, 2026
@github-actions

github-actions Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

🤖 PR meta 🤖

Preview in WordPress Playground

🎉 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: Mamaduka <mamaduka@git.wordpress.org>

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

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

📦 Bundle size

Size Change: -18 B (0%)

Total Size: 9.04 MB

📦 View Changed
Filename Size Change
build/scripts/block-editor/index.min.js 604 kB +1 B (0%)
build/scripts/components/index.min.js 370 kB +29 B (+0.01%)
build/scripts/edit-site/index.min.js 421 kB +3 B (0%)
build/scripts/editor/index.min.js 615 kB -17 B (0%)
build/scripts/media-utils/index.min.js 262 kB -34 B (-0.01%)

430327c Run

⚡ Performance

Show the results

Client side metrics exclude the server response time.

front-end-block-theme

Metric 80f49be wp/7.2 % Change
timeToFirstByte 55.05 ms +4.36% -4.63% 55.3 ms +7.41% -1.45% -0.45%
largestContentfulPaint 90 ms +6.67% -2.22% 92 ms +4.35% -4.35% -2.17%
lcpMinusTtfb 34.75 ms +13.67% -5.32% 35.85 ms +9.76% -7.53% -3.07%
wpBeforeTemplate 28.67 ms +6.63% -0.87% 29.52 ms +9.25% -1.69% -2.88%
wpTemplate 21.31 ms +6.34% -5.16% 21.66 ms +4.76% -0.88% -1.62%
wpTotal 50.77 ms +5.52% -4.04% 51.39 ms +8.08% -1.4% -1.21%
wpMemoryUsage 7.69 MB +0% -0% 7.66 MB +0% -0% 0.42%
wpDbQueries 16 +0% -0% 16 +0% -0% 0%

front-end-classic-theme

Metric 80f49be wp/7.2 % Change
timeToFirstByte 45.9 ms +5.77% -1.85% 45.7 ms +9.08% -0.88% 0.44%
largestContentfulPaint 100 ms +4% -0% 100 ms +4% -0% 0%
lcpMinusTtfb 55.1 ms +0.73% -1.36% 54.7 ms +4.11% -0.73% 0.73%
wpBeforeTemplate 26.87 ms +1.45% -2.05% 26.79 ms +5.23% -1.27% 0.3%
wpTemplate 16.03 ms +3.87% -1.87% 16.2 ms +1.91% -1.79% -1.05%
wpTotal 42.95 ms +5.56% -1.84% 42.76 ms +8.21% -1.12% 0.44%
wpMemoryUsage 6.38 MB +0% -0% 6.35 MB +0% -0% 0.51%
wpDbQueries 13 +0% -0% 13 +0% -0% 0%

media-processing

Metric 80f49be wp/7.2 % Change
mediaProcessingJpeg 400.58 ms +0.24% -0.27% 401.51 ms +1.55% -0.28% -0.23%
mediaProcessingAvif 6090.5 ms +0.23% -0.15% 6102.77 ms +0.21% -0.22% -0.2%
mediaProcessingJpegToAvif 4246.22 ms +0.06% -0.44% 4221.09 ms +0.22% -0.34% 0.6%

media-upload

Metric 80f49be wp/7.2 % Change
jpegUploadProcessing 1431.89 ms +1.44% -0.34% 1426.84 ms +0.62% -0.3% 0.35%
pngUploadProcessing 200.74 ms +14.78% -12.19% 185.85 ms +16.91% -3.03% 8.01%
largeJpegUploadProcessing 1428.39 ms +0.51% -0.21% 1423.06 ms +0.92% -0.53% 0.37%
multipleImageUploadProcessing 2055.46 ms +0.42% -6.02% 2038.44 ms +1.62% -6.2% 0.83%

post-editor

Metric 80f49be wp/7.2 % Change
serverResponse 427.38 ms +3.18% -10.82% 427.1 ms +3.41% -6.85% 0.07%
firstPaint 253.84 ms +21.86% -14.95% 498.7 ms +2.84% -50.41% -49.1%
domContentLoaded 1204.36 ms +3.56% -5.59% 1184.03 ms +1.65% -2.39% 1.72%
loaded 1205.59 ms +3.54% -5.57% 1185.31 ms +1.65% -2.39% 1.71%
firstContentfulPaint 488.96 ms +7.81% -7.98% 512.55 ms +3.69% -3.19% -4.6%
firstBlock 3718.4 ms +3.2% -4.45% 3584.96 ms +1.54% -0.97% 3.72%
type 19.8 ms +2.02% -4.85% 18.6 ms +5.75% -2.74% 6.45%
typeWithoutInspector 18.87 ms +4.88% -3.44% 19.85 ms +5.24% -2.77% -4.94%
typeWithTopToolbar 27.42 ms +5.51% -3.65% 25.75 ms +2.83% -2.25% 6.49%
typeContainer 8.9 ms +5.73% -10% 9.04 ms +5.42% -5.31% -1.55%
focus 130.94 ms +2.46% -11.13% 118.98 ms +8.11% -4.54% 10.05%
firstFocus 253.28 ms +0% -0% 223.19 ms +0% -0% 13.48%
selectAll 557.96 ms +6.94% -2.8% 537.49 ms +0.1% -1.34% 3.81%
listViewOpen 79.34 ms +3.54% -5.03% 75.35 ms +5.53% -4.26% 5.3%
inserterOpen 45.57 ms +8.29% -9.57% 43.19 ms +1.5% -10.07% 5.51%
inserterHover 12.72 ms +9.51% -6.13% 12.16 ms +5.1% -6.74% 4.61%
inserterSearch 8.92 ms +3.03% -2.91% 8.91 ms +8.98% -6.06% 0.11%
loadPatterns 660.85 ms +4.61% -2.75% 640.5 ms +4.29% -2.86% 3.18%
wpTotal 416.85 ms +2.85% -11.14% 416.4 ms +3.04% -7.07% 0.11%
wpMemoryUsage 14.74 MB +0% -0% 14.71 MB +0% -0% 0.23%
wpDbQueries 55 +0% -1.82% 55 +0% -1.82% 0%

site-editor

Metric 80f49be wp/7.2 % Change
serverResponse 423.53 ms +4.26% -6.52% 411.61 ms +5.84% -6.5% 2.9%
firstPaint 253.92 ms +12.3% -9.64% 241.19 ms +10.5% -6.1% 5.28%
domContentLoaded 1273.64 ms +1.96% -2.56% 1290.44 ms +1.27% -1.64% -1.3%
loaded 1274.68 ms +1.95% -2.55% 1291.67 ms +1.26% -1.63% -1.32%
firstContentfulPaint 473.8 ms +6.35% -35.91% 498.76 ms +6.85% -10.87% -5%
firstBlock 4902.08 ms +0.45% -0.79% 4893.65 ms +2.11% -0.75% 0.17%
type 22.99 ms +6.52% -5.74% 22.91 ms +5.33% -3.67% 0.35%
navigate 127.76 ms +12.37% -3.33% 127.04 ms +11.04% -3.3% 0.57%
loadPatterns 1374.03 ms +4.68% -4.01% 1393.83 ms +5.86% -4.64% -1.42%
loadPages 1041.62 ms +1.75% -2.7% 1071.13 ms +5.21% -1.73% -2.76%
wpTotal 412.74 ms +4.4% -6.71% 401.45 ms +5.61% -6.74% 2.81%
wpMemoryUsage 12.76 MB +0% -0% 12.73 MB +0% -0% 0.24%
wpDbQueries 44 +2.27% -0% 44 +2.27% -0% 0%

430327c 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.

As a user I expect my navigation to use the colors I selected for it in /test/e2e/specs/editor/blocks/navigation-colors.spec.js, passed after 1 failed attempt.
Error: locator.click: Error: strict mode violation: getByRole('option', { name: 'Pale cyan blue' }) resolved to 2 elements:
    1) <button type="button" role="option" tabindex="-1" aria-selected="false" aria-label="Pale cyan blue" id="components-circular-option-picker-0-9" class="components-button components-circular-option-picker__option is-next-40px-default-size"></button> aka locator('#components-circular-option-picker-0-9')
    2) <button type="button" role="option" tabindex="-1" aria-selected="false" aria-label="Pale cyan blue" id="components-circular-option-picker-1-21" class="components-button components-circular-option-picker__option is-next-40px-default-size"></button> aka locator('#components-circular-option-picker-1-21')

Call log:
  - waiting for getByRole('option', { name: 'Pale cyan blue' })

    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/blocks/navigation-colors.spec.js:315:5
Backspace in /test/e2e/specs/editor/blocks/list.spec.js, passed after 1 failed attempt.
Error: expect(received).toMatchObject(expected)

- Expected  -  4
+ Received  + 31

@@ -1,25 +1,52 @@
  Array [
    Object {
+     "attributes": Object {
+       "content": "‸1",
+       "dropCap": false,
+     },
+     "innerBlocks": Array [],
+     "name": "core/paragraph",
+   },
+   Object {
+     "attributes": Object {
+       "ordered": false,
+       "values": "",
+     },
      "innerBlocks": Array [
        Object {
          "attributes": Object {
-           "content": "1",
+           "content": "a",
+         },
+         "innerBlocks": Array [],
+         "name": "core/list-item",
+       },
+     ],
+     "name": "core/list",
+   },
+   Object {
+     "attributes": Object {
+       "ordered": false,
+       "values": "",
      },
      "innerBlocks": Array [
        Object {
+         "attributes": Object {
+           "content": "2",
+         },
          "innerBlocks": Array [
            Object {
              "attributes": Object {
-                   "content": "a‸2",
-                 },
-                 "name": "core/list-item",
+               "ordered": false,
+               "values": "",
              },
+             "innerBlocks": Array [
                Object {
                  "attributes": Object {
                    "content": "b",
                  },
+                 "innerBlocks": Array [],
                  "name": "core/list-item",
                },
              ],
              "name": "core/list",
            },

Call Log:
- Timeout 5000ms exceeded while waiting on the predicate
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/blocks/list.spec.js:2041:42
Custom Completer: should not insert disabled options in /test/e2e/specs/editor/various/autocomplete-and-mentions.spec.js, passed after 1 failed attempt.
Error: expect(received).toBe(expected) // Object.is equality

- Expected  - 1
+ Received  + 1

  <!-- wp:paragraph -->
- <p>Sorry, we are all out of ~g grapes.</p>
+ <p>Sorry, we are all out of 🍎 grapes.</p>
  <!-- /wp:paragraph -->

Call Log:
- Timeout 5000ms exceeded while waiting on the predicate
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/various/autocomplete-and-mentions.spec.js:391:7
Navigation text does not inherit the link color from the theme/group in /test/e2e/specs/editor/blocks/navigation-colors.spec.js, passed after 1 failed attempt.
Error: locator.click: Error: strict mode violation: getByRole('option', { name: 'Vivid purple' }) resolved to 2 elements:
    1) <button type="button" role="option" tabindex="-1" aria-selected="false" aria-label="Vivid purple" id="components-circular-option-picker-0-11" class="components-button components-circular-option-picker__option is-next-40px-default-size"></button> aka getByRole('tabpanel', { name: 'Default' }).getByRole('option', { name: 'Vivid purple' })
    2) <button type="button" role="option" tabindex="-1" aria-selected="false" aria-label="Vivid purple" id="components-circular-option-picker-1-23" class="components-button components-circular-option-picker__option is-next-40px-default-size"></button> aka getByRole('tabpanel', { name: 'Hover' }).getByRole('option', { name: 'Vivid purple' })

Call log:
  - waiting for getByRole('option', { name: 'Vivid purple' })

    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/blocks/navigation-colors.spec.js:177:5
Regression: updating a specific option will only change its value and will not corrupt others in /test/e2e/specs/editor/various/core-settings.spec.js, passed after 1 failed attempt.
Error: expect(received).toStrictEqual(expected) // deep equality

- Expected  - 1
+ Received  + 1

  Array [
    "rewrite_rules",
-   "SERIALIZED DATA",
+   "",
  ]
    at forEach (/home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/various/core-settings.spec.js:46:26)
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/various/core-settings.spec.js:43:35
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
can be converted to a quote in /test/e2e/specs/editor/blocks/list.spec.js, passed after 1 failed attempt.
Error: expect(received).toBe(expected) // Object.is equality

- Expected  - 1
+ Received  + 1

@@ -1,9 +1,9 @@
  <!-- wp:quote -->
  <blockquote class="wp-block-quote"><!-- wp:list -->
  <ul class="wp-block-list"><!-- wp:list-item -->
- <li>one</li>
+ <li>ne</li>
  <!-- /wp:list-item -->

  <!-- wp:list-item -->
  <li>two</li>
  <!-- /wp:list-item --></ul>

Call Log:
- Timeout 5000ms exceeded while waiting on the predicate
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/blocks/list.spec.js:436:52
can be converted when nested to paragraphs in /test/e2e/specs/editor/blocks/list.spec.js, passed after 1 failed attempt.
Error: expect(received).toBe(expected) // Object.is equality

- Expected  - 1
+ Received  + 1

  <!-- wp:paragraph -->
- <p>one</p>
+ <p>ne</p>
  <!-- /wp:paragraph -->

  <!-- wp:paragraph -->
  <p>two</p>
  <!-- /wp:paragraph -->

Call Log:
- Timeout 5000ms exceeded while waiting on the predicate
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/blocks/list.spec.js:417:52
can be created by selecting text and using keyboard shortcuts in /test/e2e/specs/editor/blocks/links.spec.js, passed after 1 failed attempt.
Error: expect(received).toMatchObject(expected)

- Expected  - 1
+ Received  + 1

  Array [
    Object {
      "attributes": Object {
-       "content": "This is Gutenberg",
+       "content": "This is https:",
      },
      "name": "core/paragraph",
    },
  ]

Call Log:
- Timeout 5000ms exceeded while waiting on the predicate
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/blocks/links.spec.js:563:41
copies attributes when inserting a sibling via the appender in /test/e2e/specs/editor/blocks/buttons.spec.js, passed after 1 failed attempt.
Error: locator.click: Error: strict mode violation: getByRole('option', { name: 'Vivid red' }) resolved to 2 elements:
    1) <button type="button" role="option" tabindex="-1" aria-selected="false" aria-label="Vivid red" id="components-circular-option-picker-0-4" class="components-button components-circular-option-picker__option is-next-40px-default-size"></button> aka locator('#components-circular-option-picker-0-4')
    2) <button type="button" role="option" tabindex="-1" aria-selected="false" aria-label="Vivid red" id="components-circular-option-picker-1-16" class="components-button components-circular-option-picker__option is-next-40px-default-size"></button> aka locator('#components-circular-option-picker-1-16')

Call log:
  - waiting for getByRole('option', { name: 'Vivid red' })

    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/blocks/buttons.spec.js:448:59
does not select blocks in the canvas preview when editing from the sidebar (Site Editor v2) in /test/e2e/specs/site-editor/navigation-sidebar-list-view.spec.js, passed after 1 failed attempt.
Error: expect(locator).toBeFocused() failed

Locator: getByRole('combobox', { name: 'Search or type URL' })
Expected: focused
Timeout: 5000ms
Error: element(s) not found

Call log:
  - Expect "toBeFocused" getByRole('combobox', { name: 'Search or type URL' }) with timeout 5000ms
  - waiting for getByRole('combobox', { name: 'Search or type URL' })

    at LinkControl.useLinkControlSearch (/home/runner/work/gutenberg/gutenberg/test/e2e/specs/site-editor/navigation-sidebar-list-view.spec.js:389:47)
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/site-editor/navigation-sidebar-list-view.spec.js:179:21
should be immediately saved on indentation in /test/e2e/specs/editor/blocks/list.spec.js, passed after 1 failed attempt.
Error: expect(received).toBe(expected) // Object.is equality

- Expected  - 1
+ Received  + 1

@@ -1,8 +1,8 @@
  <!-- wp:list -->
  <ul class="wp-block-list"><!-- wp:list-item -->
- <li>one<!-- wp:list -->
+ <li>ne<!-- wp:list -->
  <ul class="wp-block-list"><!-- wp:list-item -->
  <li></li>
  <!-- /wp:list-item --></ul>
  <!-- /wp:list --></li>
  <!-- /wp:list-item --></ul>

Call Log:
- Timeout 5000ms exceeded while waiting on the predicate
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/blocks/list.spec.js:694:52
should change the indented list type in /test/e2e/specs/editor/blocks/list.spec.js, passed after 1 failed attempt.
TimeoutError: locator.click: Timeout 10000ms exceeded.
Call log:
  - waiting for locator('role=toolbar[name="Block tools"i]').locator('role=button[name="Indent"]')

    at Editor.clickBlockToolbarButton (/home/runner/work/gutenberg/gutenberg/packages/e2e-test-utils-playwright/src/editor/click-block-toolbar-button.ts:17:15)
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/blocks/list.spec.js:727:3
should create paragraph on split at end and merge back with content in /test/e2e/specs/editor/blocks/list.spec.js, passed after 1 failed attempt.
Error: expect(received).toBe(expected) // Object.is equality

- Expected  - 1
+ Received  + 1

@@ -1,8 +1,8 @@
  <!-- wp:list -->
  <ul class="wp-block-list"><!-- wp:list-item -->
- <li>one</li>
+ <li>e</li>
  <!-- /wp:list-item --></ul>
  <!-- /wp:list -->

  <!-- wp:paragraph -->
  <p></p>

Call Log:
- Timeout 5000ms exceeded while waiting on the predicate
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/blocks/list.spec.js:461:52
should cut and paste individual blocks with collapsed selection in /test/e2e/specs/editor/various/copy-cut-paste.spec.js, passed after 1 failed attempt.
Error: expect(string).toMatchSnapshot(expected) failed

  @@ -1,3 +1,3 @@
   <!-- wp:paragraph -->
  -<p>2Cut - collapsed selection</p>
  +<p>2</p>
   <!-- /wp:paragraph -->


    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/various/copy-cut-paste.spec.js:45:49
should indent and outdent level 2 in /test/e2e/specs/editor/blocks/list.spec.js, passed after 1 failed attempt.
TimeoutError: locator.click: Timeout 10000ms exceeded.
Call log:
  - waiting for locator('role=toolbar[name="Block tools"i]').locator('role=button[name="Indent"]')

Truncated. See the full report.

430327c Run

@ciampo ciampo added the [Type] Bug An existing feature does not function as intended label Oct 27, 2026 — with ChatGPT Codex Connector
@ciampo ciampo self-assigned this Oct 27, 2026
@ciampo
ciampo marked this pull request as ready for review October 27, 2026 17:21
@ciampo
ciampo requested a review from a team as a code owner October 27, 2026 17:21
@ciampo
ciampo requested review from Mamaduka and t-hamano October 27, 2026 17:21
@ciampo

ciampo commented Oct 27, 2026

Copy link
Copy Markdown
Contributor Author

Whoever reviews this PR, feel free to merge it too if approved. I may not be super available over the next few days.

@Mamaduka Mamaduka 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.

Thanks, Marco!

@ciampo
ciampo merged commit 280d299 into wp/7.2 Oct 28, 2026
98 of 99 checks passed
@ciampo
ciampo deleted the codex/backport-85488-wp-7.2 branch October 28, 2026 00:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Package] UI /packages/ui [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