Skip to content

Menu: Use the external icon for new-tab links - #82345

Closed
ciampo wants to merge 2 commits into
trunkfrom
codex/menu-external-link-icon
Closed

ciampo wants to merge 2 commits into
trunkfrom
codex/menu-external-link-icon

Conversation

@ciampo

@ciampo ciampo commented Sep 2, 2026 •

Copy link
Copy Markdown
Contributor

#82321 (comment)

What?

Replaces the arrow glyph shown by Menu.LinkItem for new-tab links with the 16px external icon from @wordpress/icons. The icon remains inline after the item label.

Why?

The text arrow suits links in prose, while menu items generally use the icon treatment. This PR tries the alternative proposed in the linked discussion.

How?

Renders Icon inside the existing accessible new-tab indicator and removes the glyph-specific pseudo-element styles. The link target and accessible name do not change.

Testing Instructions

  1. Open Design System > Components > Menu > Link Item in Storybook.
  2. Open the menu.
  3. Confirm that the external-link icon appears inline after the first two item labels.
  4. Confirm that the in-page link has no icon.

Testing Instructions for Keyboard

  1. Press Tab to focus Open menu, then press Enter.
  2. Use the arrow keys to move through every item.
  3. Confirm that focus and activation work as before.

Screenshots

Before After
Screenshot 2026-09-02 at 18 37 55 Screenshot 2026-09-02 at 18 39 45

For reference, Link and LinkButton components:

Screenshot 2026-09-02 at 18 40 27 Screenshot 2026-09-02 at 18 40 40

Use of AI Tools

Assisted by Codex.

Summary by CodeRabbit

  • UI Improvements
    • Updated menu links that open in a new tab to display an external-link icon instead of an arrow.
    • Improved the icon’s alignment and presentation within the link indicator.

@github-actions github-actions Bot added the [Package] UI /packages/ui label Sep 2, 2026
@github-actions

github-actions Bot commented Sep 2, 2026 •

Copy link
Copy Markdown

🤖 PR meta 🤖

📦 Bundle size

Size Change: +110 B (0%)

Total Size: 8.01 MB

📦 View Changed
Filename Size Change
build/scripts/edit-site/index.min.js 378 kB +42 B (+0.01%)
build/scripts/editor/index.min.js 583 kB +2 B (0%)
build/scripts/media-utils/index.min.js 201 kB +66 B (+0.03%)

fbbc1b0 Run

⚡ Performance

Show the results

Client side metrics exclude the server response time.

front-end-block-theme

Metric ce8be82 trunk % Change
timeToFirstByte 53.2 ms +10.43% -5.55% 57.4 ms +6.18% -8.19% -7.32%
largestContentfulPaint 88 ms +4.55% -4.55% 92 ms +0% -8.7% -4.35%
lcpMinusTtfb 32.3 ms +13.78% -6.5% 31.95 ms +11.74% -4.54% 1.1%
wpBeforeTemplate 25.04 ms +12.14% -6.67% 26.2 ms +13.21% -8.97% -4.43%
wpTemplate 24.28 ms +3.38% -3.91% 24.82 ms +3.06% -0.97% -2.18%
wpTotal 49.36 ms +8.95% -5.41% 52.75 ms +6.71% -6.82% -6.43%
wpMemoryUsage 7.54 MB +0% -0% 7.50 MB +0% -0% 0.46%
wpDbQueries 17 +0% -0% 17 +0% -0% 0%

front-end-classic-theme

Metric ce8be82 trunk % Change
timeToFirstByte 34.95 ms +11.44% -2% 42.25 ms +9.59% -0.95% -17.28%
largestContentfulPaint 76 ms +7.89% -0% 86 ms +6.98% -2.33% -11.63%
lcpMinusTtfb 41.6 ms +0.72% -3.49% 42.85 ms +3.97% -1.63% -2.92%
wpBeforeTemplate 20.94 ms +16.62% -1.05% 21.22 ms +8.91% -2.26% -1.32%
wpTemplate 11.02 ms +2.9% -2.36% 18.15 ms +6.28% -1.76% -39.28%
wpTotal 32.16 ms +11.54% -1.99% 39.28 ms +10.08% -1.3% -18.13%
wpMemoryUsage 5.42 MB +0% -0% 6.12 MB +0% -0% -11.5%
wpDbQueries 10 +0% -0% 14 +0% -0% -28.57%

media-processing

Metric ce8be82 trunk % Change
mediaProcessingJpeg 410.58 ms +3.63% -0.53% 408.81 ms +1.37% -0.51% 0.43%
mediaProcessingAvif 6307.52 ms +0.42% -0.14% 6314.55 ms +0.25% -0.18% -0.11%
mediaProcessingJpegToAvif 4407.71 ms +0.36% -0.06% 4418.04 ms +0.09% -0.11% -0.23%

media-upload

Metric ce8be82 trunk % Change
jpegUploadProcessing 1468 ms +34.84% -2.35% 1432.17 ms +1% -0.26% 2.5%
pngUploadProcessing 204.44 ms +1.39% -1.53% 218.55 ms +2.48% -2.56% -6.46%
largeJpegUploadProcessing 1430.8 ms +0.25% -0.58% 1425.17 ms +1.26% -0.28% 0.4%
multipleImageUploadProcessing 1605.24 ms +30.34% -2.1% 1571.95 ms +9.7% -0.32% 2.12%

post-editor

Metric ce8be82 trunk % Change
serverResponse 438.42 ms +6.12% -5.94% 452.07 ms +6.22% -5.77% -3.02%
firstPaint 231.24 ms +20.49% -27.51% 247.95 ms +1.91% -15.75% -6.74%
domContentLoaded 1326.62 ms +2.79% -0.51% 1409.61 ms +2.02% -2.52% -5.89%
loaded 1327.97 ms +2.81% -0.51% 1410.99 ms +2.03% -2.52% -5.88%
firstContentfulPaint 439.26 ms +3.46% -8.88% 465.08 ms +3.07% -4.06% -5.55%
firstBlock 3521.67 ms +0.75% -0.57% 3729.89 ms +0.74% -1.77% -5.58%
type 21.18 ms +14.68% -20.87% 22.89 ms +16.51% -11.62% -7.47%
typeWithoutInspector 21.46 ms +12.67% -24.79% 23.21 ms +15.3% -11.72% -7.54%
typeWithTopToolbar 23.23 ms +18.6% -10.93% 27.61 ms +12.46% -19.01% -15.86%
typeContainer 9.82 ms +10.59% -10.59% 9.96 ms +2.61% -9.74% -1.41%
focus 84.68 ms +13.38% -2.82% 85.17 ms +12.86% -6.82% -0.58%
firstFocus 198.9 ms +0% -0% 192.11 ms +0% -0% 3.53%
selectAll 589.56 ms +0.73% -0.34% 604.29 ms +0.14% -2.98% -2.44%
listViewOpen 68.08 ms +19.77% -4.45% 75 ms +10.97% -9.33% -9.23%
inserterOpen 24.91 ms +9.96% -6.38% 26.99 ms +9.56% -13.82% -7.71%
inserterHover 4.47 ms +4.47% -10.07% 5.04 ms +4.17% -21.03% -11.31%
inserterSearch 8.79 ms +14.68% -6.48% 9.22 ms +7.16% -7.7% -4.66%
loadPatterns 661.88 ms +1.76% -2.17% 701.82 ms +3.99% -0.99% -5.69%
wpTotal 427.03 ms +6.35% -6.03% 440.99 ms +6.42% -5.92% -3.17%
wpMemoryUsage 13.13 MB +0% -0% 13.10 MB +0% -0% 0.22%
wpDbQueries 54 +0% -1.85% 54 +0% -1.85% 0%

site-editor

Metric ce8be82 trunk % Change
serverResponse 581.19 ms +1.11% -8.81% 547.23 ms +3.18% -5.5% 6.21%
firstPaint 253.37 ms +10.1% -9.12% 310.34 ms +19.61% -18.59% -18.36%
domContentLoaded 1434.25 ms +0.84% -0.69% 1426.62 ms +0.43% -1.32% 0.53%
loaded 1435.56 ms +0.83% -0.7% 1427.9 ms +0.43% -1.31% 0.54%
firstContentfulPaint 451.49 ms +1.75% -2% 452.26 ms +1.04% -2.19% -0.17%
firstBlock 4554.69 ms +0.75% -0.68% 4464.97 ms +1.16% -0.46% 2.01%
type 23.16 ms +8.12% -22.97% 20.28 ms +13.56% -7.89% 14.2%
navigate 100.31 ms +10.64% -7.42% 108 ms +1.37% -13.23% -7.12%
loadPatterns 1397.8 ms +16.97% -9.98% 1523.65 ms +11.43% -6.12% -8.26%
loadPages 1558.78 ms +5.51% -8.88% 1227.12 ms +30.77% -9.36% 27.03%
wpTotal 571.57 ms +1.08% -9% 537.56 ms +3.21% -5.6% 6.33%
wpMemoryUsage 12.02 MB +0% -0% 11.99 MB +0% -0% 0.3%
wpDbQueries 43 +2.33% -0% 43 +2.33% -0% 0%

fbbc1b0 Run

@ciampo ciampo self-assigned this Sep 2, 2026
@ciampo ciampo added the [Type] Enhancement A suggestion for improvement. label Sep 2, 2026
@ciampo
ciampo requested a review from a team September 2, 2026 16:42
@ciampo
ciampo marked this pull request as ready for review September 2, 2026 16:42
@ciampo
ciampo requested a review from a team as a code owner September 2, 2026 16:42
@github-actions

github-actions Bot commented Sep 2, 2026 •

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: ciampo <mciampini@git.wordpress.org>
Co-authored-by: mirka <0mirka00@git.wordpress.org>
Co-authored-by: jasmussen <joen@git.wordpress.org>
Co-authored-by: Mamaduka <mamaduka@git.wordpress.org>
Co-authored-by: fcoveram <fcoveram@git.wordpress.org>

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

@coderabbitai

coderabbitai Bot commented Sep 2, 2026 •

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Team

Run ID: fb8c0911-58fc-4159-86bf-57646fa0c51e

📥 Commits

Reviewing files that changed from the base of the PR and between 33596c4 and fbbc1b0.

📒 Files selected for processing (3)
  • packages/ui/CHANGELOG.md
  • packages/ui/src/menu/link-item.tsx
  • packages/ui/src/menu/style.module.css

Included review availability: Your plan provides up to 8 included reviews per hour; 6 remain after this review.


📝 Walkthrough

Walkthrough

The Menu external-link indicator now renders an external-link icon for links that open in a new tab. Its CSS uses inline-flex alignment, and the changelog records the enhancement.

Changes

Menu external-link indicator

Layer / File(s) Summary
Render and style the external-link indicator
packages/ui/src/menu/link-item.tsx, packages/ui/src/menu/style.module.css, packages/ui/CHANGELOG.md
LinkItem renders the 16px external-link icon. The indicator uses centered inline-flex alignment. The changelog documents the behavior.

Estimated code review effort: 1 (Trivial) | ~2 minutes

Merge Risk: ⚪ Minimal · up to fbbc1

This localized UI change replaces the new-tab arrow with an external-link icon without changing link behavior or accessibility semantics; no actionable merge-blocking risk remains.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: using the external icon for links that open in a new tab.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 1…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 1 files. (2 skipped: 2 unsupported.)

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/menu-external-link-icon

Warning

Some tools did not complete. Review the errors below.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint install timed out. The project may have too many dependencies for the sandbox.


Comment @coderabbitai help to get the list of available commands.

@ciampo

ciampo commented Sep 2, 2026

Copy link
Copy Markdown
Contributor Author

@WordPress/gutenberg-design I opened a PR so you can understand better if we should go ahead with the change.

I see three options:

  1. Keep as proposed in this PR (Menu.LinkItem uses the icon, Link and LinkButton use the ↗ character)
  2. Update all three components to use the icon
  3. Reject this PR and keep all three components to use the ↗ character

@mirka

mirka commented Sep 2, 2026

Copy link
Copy Markdown
Member

No strong opinion between 2 or 3, but I hope we can avoid 1 🙈 We should align on a single symbol (icon/glyph, doesn't matter) and use it everywhere.

@jasmussen

Copy link
Copy Markdown
Contributor

A subtle discussion, and now a PR. Your speed is hard to keep up with, thank you for all the contributions!

Let's unpack this one, though:

  • The in-text version, ↗, is for the time being still the right icon for in-text. Inline. It is specifically a glyph so it inherits size and font weight and looks part of the text. There is an argument that the more designed external link icon can be used in a similar way at some point in the future, e.g. Icons: Convert to being stroke-based #81274, but even that is unclear.
  • The full icon-version is meant to not be used inline, but as an icon. This is for icon-only versions of the button. Or in the case of dropdown menus, this means in the menus icon slot.

To be clear, this is what I mean about menu's icon slot, shown here on the right in the legacy menu:

image

So until we change the general guidance and have stroke-based icons that could better let us use icons (not glyph) inline in text, I think we should maintain the current guidelines of differentiating between block level and inline as the rule for when to use the external icon, and when to use the ↗ glyph. WDYT?

@Mamaduka

Mamaduka commented Sep 3, 2026

Copy link
Copy Markdown
Member

To be clear, this is what I mean about menu's icon slot, shown here on the right in the legacy menu:

I think this will invite a lot of complexity. Someone could go and create Frankenstein's MenuItem and expect it to look good.

A possible MenuItem combo: normal icon + link menu item + opens in new tab icon + shortcut.

@fcoveram

fcoveram commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

I think this will invite a lot of complexity. Someone could go and create Frankenstein's MenuItem and expect it to look good.

I second this concern. It opens the door to creating visually noisy menus.

To @jasmussen's point and with the new menu structure in mind, I would say that the external symbol as an icon in menu item doesn't make much sense when the glyph version exists for inline text.

Because of that, I'm drawn to keep all three components to use the ↗ character

@ciampo

ciampo commented Sep 4, 2026 •

Copy link
Copy Markdown
Contributor Author

Given that the new menu usually expects icons before the label, my preference is also to continue using the ↗ character.

I'm going to close this PR for now, we can always re-discuss in the future

@ciampo ciampo closed this Sep 4, 2026
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.

5 participants