Skip to content

UI: Support horizontal orientation in Menu - #85289

Closed
ciampo wants to merge 5 commits into
trunkfrom
add/ui-menu-horizontal-orientation
Closed

ciampo wants to merge 5 commits into
trunkfrom
add/ui-menu-horizontal-orientation

Conversation

@ciampo

@ciampo ciampo commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

See #85222.

What?

Add orientation="horizontal" to Menu.Root and a compact horizontal action menu example in Storybook.

Why?

Give reaction pickers a compact row while retaining Menu's semantics and keyboard behavior.

How?

Use neutral highlights and a pressed appearance for checked items, without checkmarks. Scope vertical alignment grids to vertical menus. Use horizontal menus for flat icon or emoji actions, and vertical menus for rich content and submenus.

Testing Instructions

  1. Run npm run storybook:dev and open Menu → Compact horizontal action menu.
  2. Open Add reaction. Confirm Heart looks pressed, hover an emoji to see its name, and toggle a reaction twice to add and remove it.
  3. Check dark mode, RTL, and a narrow viewport. Confirm the popup stays inside the viewport and scrolls when needed, and vertical stories are unchanged.

Testing Instructions for Keyboard

  1. Tab to Add reaction and press Enter. Navigate with Left/Right Arrow and Home/End; type r to focus Rocket. In RTL, Left Arrow advances through the row. Keyboard focus should have a separate outline.
  2. Press Enter or Space to toggle a reaction and close the menu. Reopen it, focus an emoji to show its tooltip, and press Escape once. Both should close, and focus should return to the trigger.

Screenshots or screencast

Standalone Storybook at 6ac996e47b0, with Heart checked and Rocket focused. Viewport: 360 × 180.

Light Dark, RTL
Light horizontal menu with Heart checked and Rocket focused. Dark RTL horizontal menu with Heart checked and Rocket focused.

Use of AI Tools

Implementation, tests, screenshots, and description prepared with Codex.

@github-actions

github-actions Bot commented Oct 21, 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: mirka <0mirka00@git.wordpress.org>
Co-authored-by: fcoveram <fcoveram@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.


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: +14.6 kB (+0.16%)

Total Size: 9.06 MB

📦 View Changed
Filename Size Change
build/scripts/block-editor/index.min.js 609 kB +2.51 kB (+0.41%)
build/scripts/components/index.min.js 375 kB +2.6 kB (+0.7%)
build/scripts/edit-site/index.min.js 426 kB +2.97 kB (+0.7%)
build/scripts/editor/index.min.js 622 kB +3.2 kB (+0.52%)
build/scripts/media-utils/index.min.js 268 kB +3.33 kB (+1.25%)

3395706 Run

⚡ Performance

Show the results

Client side metrics exclude the server response time.

front-end-block-theme

Metric ea2ee12 trunk % Change
timeToFirstByte 54.35 ms +5.8% -2.21% 53.1 ms +3.86% -1.88% 2.35%
largestContentfulPaint 96 ms +2.08% -6.25% 92 ms +4.35% -4.35% 4.35%
lcpMinusTtfb 42.25 ms +2.37% -18.11% 38.65 ms +11.51% -11.13% 9.31%
wpBeforeTemplate 29.12 ms +11.98% -1.34% 28.42 ms +0.91% -1.76% 2.46%
wpTemplate 21.09 ms +5.93% -1.75% 20.55 ms +3.99% -3.21% 2.63%
wpTotal 50.8 ms +5.87% -2.64% 49.43 ms +4.09% -2.39% 2.77%
wpMemoryUsage 7.65 MB +0% -0% 7.61 MB +0% -0% 0.46%
wpDbQueries 16 +0% -0% 16 +0% -0% 0%

front-end-classic-theme

Metric ea2ee12 trunk % Change
timeToFirstByte 45.7 ms +5.91% -1.09% 45.55 ms +6.04% -1.87% 0.33%
largestContentfulPaint 100 ms +4% -0% 100 ms +2% -0% 0%
lcpMinusTtfb 54.8 ms +2.19% -0.82% 54.65 ms +1.28% -3.29% 0.27%
wpBeforeTemplate 26.66 ms +4.24% -1.09% 26.42 ms +8.52% -1.85% 0.91%
wpTemplate 16.19 ms +0.62% -1.67% 15.86 ms +3.53% -0.69% 2.08%
wpTotal 42.75 ms +5.54% -1.17% 42.63 ms +6.26% -1.74% 0.28%
wpMemoryUsage 6.34 MB +0% -0% 6.30 MB +0% -0% 0.58%
wpDbQueries 13 +0% -0% 13 +0% -0% 0%

media-processing

Metric ea2ee12 trunk % Change
mediaProcessingJpeg 398.51 ms +1.76% -0.28% 398.11 ms +0.83% -0.72% 0.1%
mediaProcessingAvif 6076.36 ms +0.06% -0.21% 6071.17 ms +0.7% -0.35% 0.09%
mediaProcessingJpegToAvif 4210.52 ms +0.26% -0.2% 4166.35 ms +0.14% -0.14% 1.06%

media-upload

Metric ea2ee12 trunk % Change
jpegUploadProcessing 1442.39 ms +32.68% -1.98% 1442.11 ms +1.22% -0.61% 0.02%
pngUploadProcessing 189.09 ms +16.16% -6.72% 191.41 ms +17.76% -11.92% -1.21%
largeJpegUploadProcessing 1436.75 ms +0.53% -1.63% 1422.15 ms +0.55% -0.57% 1.03%
multipleImageUploadProcessing 2055.84 ms +2.8% -21.37% 2015.33 ms +0.39% -22.36% 2.01%

post-editor

Metric ea2ee12 trunk % Change
serverResponse 268.05 ms +1.36% -6.35% 285.78 ms +2.73% -9.43% -6.2%
firstPaint 237.58 ms +49.15% -32.22% 175.06 ms +89.83% -18.19% 35.71%
domContentLoaded 765.27 ms +2.65% -1.86% 789.8 ms +2.17% -3.74% -3.11%
loaded 766.12 ms +2.71% -1.82% 790.81 ms +2.34% -3.71% -3.12%
firstContentfulPaint 353.01 ms +1.32% -2.44% 356.24 ms +1.3% -4.5% -0.91%
firstBlock 2242.29 ms +2.39% -2.29% 2329.4 ms +1.24% -1.34% -3.74%
type 14.4 ms +14.44% -5.35% 13.59 ms +5.45% -1.18% 5.96%
typeWithoutInspector 13.69 ms +9.79% -2.19% 13.98 ms +3.22% -2.65% -2.07%
typeWithTopToolbar 18.43 ms +4.18% -11.72% 17.01 ms +8.64% -2.88% 8.35%
typeContainer 7.06 ms +17.14% -9.49% 6.32 ms +3.64% -3.8% 11.71%
focus 81.54 ms +8.85% -5.02% 83.5 ms +7.77% -5.68% -2.35%
firstFocus 202.35 ms +0% -0% 180.25 ms +0% -0% 12.26%
selectAll 391.85 ms +1.31% -3.48% 341.15 ms +2.08% -2.32% 14.86%
listViewOpen 50.56 ms +17.96% -1.33% 50.77 ms +9.12% -8.17% -0.41%
inserterOpen 29.65 ms +7.66% -11.94% 28.19 ms +6.42% -4.97% 5.18%
inserterHover 9.15 ms +6.23% -4.15% 10.02 ms +8.08% -12.08% -8.68%
inserterSearch 6.78 ms +3.1% -7.37% 7.09 ms +1.55% -8.6% -4.37%
loadPatterns 438.22 ms +4.57% -1.23% 446.04 ms +3.48% -0.6% -1.75%
wpTotal 259.94 ms +1.7% -6.67% 277.84 ms +2.95% -9.53% -6.44%
wpMemoryUsage 14.69 MB +0% -0% 14.65 MB +0% -0% 0.25%
wpDbQueries 55 +0% -0% 55 +0% -0% 0%

site-editor

Metric ea2ee12 trunk % Change
serverResponse 253.67 ms +3.67% -5.65% 256.51 ms +2.37% -8.36% -1.11%
firstPaint 173.45 ms +94.67% -12.36% 167.64 ms +7.03% -8.88% 3.47%
domContentLoaded 787.93 ms +1.77% -1.52% 786.14 ms +2.3% -2.01% 0.23%
loaded 788.7 ms +1.75% -1.51% 786.87 ms +2.3% -1.96% 0.23%
firstContentfulPaint 345.58 ms +3.06% -2.69% 337.02 ms +2.2% -3.95% 2.54%
firstBlock 2897.06 ms +1.95% -1.12% 2866.61 ms +1.72% -0.72% 1.06%
type 14.54 ms +6.19% -7.84% 14.15 ms +1.91% -1.55% 2.76%
navigate 79.18 ms +32.47% -5.7% 78.5 ms +32.39% -1.13% 0.87%
loadPatterns 943.94 ms +13.84% -3.08% 993.12 ms +18.51% -10.01% -4.95%
loadPages 950.7 ms +3.55% -1.89% 996.73 ms +0.49% -2.07% -4.62%
wpTotal 247.33 ms +3.68% -5.82% 250.15 ms +2.52% -8.57% -1.13%
wpMemoryUsage 12.70 MB +0% -0% 12.67 MB +0% -0% 0.29%
wpDbQueries 44.5 +1.12% -1.12% 44.5 +1.12% -1.12% 0%

3395706 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.

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
keeps the blocks selected after dropping a multi-selection in /test/e2e/specs/editor/various/draggable-blocks.spec.js, passed after 1 failed attempt.
TypeError: Cannot read properties of null (reading 'y')
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/various/draggable-blocks.spec.js:824:57
    at dragSelectionBelowLanding (/home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/various/draggable-blocks.spec.js:823:3)
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/various/draggable-blocks.spec.js:908:3
refuses the drop and uploads nothing in /test/e2e/specs/editor/various/single-file-placeholder-drop.spec.js, passed after 1 failed attempt.
Error: expect(received).toHaveLength(expected)

Expected length: 0
Received length: 1
Received array:  [{"_links": {"about": [{"href": "http://localhost:8889/wp-json/wp/v2/types/attachment"}], "author": [{"embeddable": true, "href": "http://localhost:8889/wp-json/wp/v2/users/1"}], "collection": [{"href": "http://localhost:8889/wp-json/wp/v2/media"}], "curies": [{"href": "https://api.w.org/{rel}", "name": "wp", "templated": true}], "replies": [{"embeddable": true, "href": "http://localhost:8889/wp-json/wp/v2/comments?post=223"}], "self": [{"href": "http://localhost:8889/wp-json/wp/v2/media/223", "targetHints": {"allow": ["GET", "POST", "PUT", "PATCH", "DELETE"]}}], "wp:attached-to": [{"embeddable": true, "href": "http://localhost:8889/wp-json/wp/v2/posts/222", "id": 222, "post_type": "post"}]}, "alt_text": "", "author": 1, "caption": {"rendered": ""}, "class_list": ["post-223", "attachment", "type-attachment", "status-inherit", "hentry", "entry"], "comment_status": "open", "date": "2026-10-21T14:41:44", "date_gmt": "2026-10-21T14:41:44", "description": {"rendered": "<p class=\"attachment\"><a href='http://localhost:8889/wp-content/uploads/2026/10/538b813c-75a2-440e-8c72-171d822dc1e5.png'><img loading=\"lazy\" decoding=\"async\" width=\"10\" height=\"10\" src=\"http://localhost:8889/wp-content/uploads/2026/10/538b813c-75a2-440e-8c72-171d822dc1e5.png\" class=\"attachment-medium size-medium\" alt=\"\" style=\"width:100%;height:100%;max-width:10px;\" /></a></p>
"}, "featured_media": 0, "filename": "538b813c-75a2-440e-8c72-171d822dc1e5.png", "filesize": 80, "guid": {"rendered": "http://localhost:8889/wp-content/uploads/2026/10/538b813c-75a2-440e-8c72-171d822dc1e5.png"}, "id": 223, "link": "http://localhost:8889/?attachment_id=223", "media_details": {"file": "2026/10/538b813c-75a2-440e-8c72-171d822dc1e5.png", "filesize": 80, "height": 10, "image_meta": {"alt": "", "aperture": "0", "camera": "", "caption": "", "copyright": "", "created_timestamp": "0", "credit": "", "focal_length": "0", "iso": "0", "keywords": [], "orientation": "0", "shutter_speed": "0", "title": ""}, "sizes": {}, "width": 10}, "media_type": "image", "meta": [], "mime_type": "image/png", "modified": "2026-10-21T14:41:44", "modified_gmt": "2026-10-21T14:41:44", "ping_status": "closed", "post": 222, "slug": "538b813c-75a2-440e-8c72-171d822dc1e5", "source_url": "http://localhost:8889/wp-content/uploads/2026/10/538b813c-75a2-440e-8c72-171d822dc1e5.png", "status": "inherit", "template": "", "title": {"rendered": "538b813c-75a2-440e-8c72-171d822dc1e5"}, "type": "attachment"}]
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/various/single-file-placeholder-drop.spec.js:71:45

3395706 Run

@github-actions github-actions Bot added the [Package] UI /packages/ui label Oct 21, 2026
@ciampo ciampo self-assigned this Oct 21, 2026
@ciampo ciampo added the [Type] Enhancement A suggestion for improvement. label Oct 21, 2026
@ciampo
ciampo requested review from a team, Mamaduka and adamsilverstein October 21, 2026 14:21
@ciampo
ciampo marked this pull request as ready for review October 21, 2026 14:22
@ciampo
ciampo requested a review from a team as a code owner October 21, 2026 14:22
@fcoveram

Copy link
Copy Markdown
Contributor

I tested it with the cursor and the keyboard, and it works as expected. Mention #84573 as the work there is connected to this one. For the emoji picker happening in #85222, this should work with a single selection, right?

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

The current "pressed" styling is way too heavy, no?

My sense is that it's too early to try and create horizontal support for the entire Menu component. The reactions menu is likely a pretty special case. And even if it isn't, we don't know exactly what the other use cases are going to need.

I would lean toward keeping it a one-off and not try to absorb it into the wp-ui Menu until we have more use cases.

@ciampo

ciampo commented Oct 21, 2026

Copy link
Copy Markdown
Contributor Author

The current "pressed" styling is way too heavy, no?

Given that those are technically checkbox (or radio) items, I didn't know how to otherwise signal that they're "checked" 🤔 It's definitely a design challenge, on top of what's being discussed in #80405

My sense is that it's too early to try and create horizontal support for the entire Menu component. The reactions menu is likely a pretty special case. And even if it isn't, we don't know exactly what the other use cases are going to need.

That was my gut instinct, too, as I mentioned in #85222 (comment) and following.

That's why I had originally suggested that the "app code" uses Base UI directly and composes it with other existing @wordpress/ui components, at least to start.

I'm also on the fence on whether this is a good enough abstraction for all "horizontal menus"; potentially, we may want to eventually create a separate "reaction menu" higher-level component?

For the emoji picker happening in #85222, this should work with a single selection, right?

That depends on the app logic, ie whether a user can leave more than one reaction on the same "item" — checkbox (and therefore multple selection) if the answer is "yes", radio (and single selection) if the answer is "no"

@Mamaduka

Copy link
Copy Markdown
Member

It seems this isn't something we would like to rush and ship during 7.2 beta, am I correct?

@ciampo

ciampo commented Oct 27, 2026

Copy link
Copy Markdown
Contributor Author

No, but I'm not even sure that it's something we'd like to ship in its current form in general.

The Emoji Picker seems enough of a special case that we may want to create a separate high-level component with its own style exceptions compared to Menu, and separately understand if / how we want to support horizontal/grid menus via the Menu component

@Mamaduka

Copy link
Copy Markdown
Member

That makes sense. Especially if we decide to ship the full pick on 7.3. Based on that, maybe it's better to ship minimal changes from #85566. Needs some polishing, but it can work as a beta/RC cycle fix.

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

Labels

[Package] UI /packages/ui [Type] Enhancement A suggestion for improvement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants