Skip to content

Editor: List the menus a page is added to in the pre-publish panel - #85762

Draft
jeryj wants to merge 15 commits into
add/navigation-remove-links-on-deletefrom
add/navigation-auto-add-pages-publish-panel
Draft

jeryj wants to merge 15 commits into
add/navigation-remove-links-on-deletefrom
add/navigation-auto-add-pages-publish-panel

Conversation

@jeryj

@jeryj jeryj commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

What?

A page's pre-publish panel gets a "Menus" section listing the Navigation Menus the page appears in once it is published: the menus that already link to it, whose links go live with the page, and the menus with "Auto add new pages" on that add a link to it. Each menu links to its editor.

Stacked on #85589, which is stacked on #84508 (the "Auto add new pages" setting). The diff against that branch is only this change.

Why?

Part of #85156. Publishing a page now edits menus the author is not looking at. In #16635, where this feature was first discussed, @mtias asked for publish-time feedback that is "a lot more clear and ideally actionable — a link to the menu, a way to preview it". This is that link.

How?

  • MaybeNavigationMenusPanel in packages/editor renders after the other pre-publish suggestions, for the page post type only, since only pages are auto-added.
  • It reads the wp_navigation records and parses their content with the default block parser. A menu that already links to the page is listed as is. For the rest, it keeps the ones with wp_navigation_auto_add_pages on and applies the same check as the server: a child page is listed only for menus that link to its parent, naming the link it goes under.
  • Each menu links to site-editor.php?p=/wp_navigation/<id>, or to admin.php?page=site-editor-v2&p=/navigation/edit/<id> when the extensible site editor experiment is on (window.__experimentalExtensibleSiteEditor).
  • The section is hidden when the page would appear in no menu.

Testing Instructions

  1. In the site editor, open a Navigation Menu and switch "Auto add new pages" on.
  2. Create a second menu and leave the setting off.
  3. Create a new page and click Publish. The pre-publish panel shows "Menus: ", which expands to a link to that menu. The second menu is not listed.
  4. Save a page as a draft, add a link to it to the second menu, and open the draft. Its pre-publish panel lists both menus.
  5. Follow the link. It opens the menu in the site editor, or in the extensible site editor when that experiment is on.
  6. Create a page as a child of a page the first menu links to. Its pre-publish panel says ", under ".
  7. Create a new post. There is no "Menus" section.

Automated

npm run test:e2e -- test/e2e/specs/editor/blocks/navigation-auto-add-pages-publish-panel.spec.ts

The extensible site editor link was checked by enabling the experiment on the test site and running the same spec with GUTENBERG_E2E_SITE_EDITOR_V2=1; the v2 runner only picks up specs/site-editor/**, so CI covers the current site editor link.

🤖 Generated with Claude Code

https://claude.ai/code/session_0199oMWAas4xDSnjTYeDtPxL

@jeryj jeryj added [Type] Enhancement A suggestion for improvement. [Package] Editor /packages/editor [Block] Navigation Affects the Navigation Block labels 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: jeryj <jeryj@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: +698 B (+0.01%)

Total Size: 8.73 MB

📦 View Changed
Filename Size Change
build/scripts/editor/index.min.js 575 kB +637 B (+0.11%)
build/styles/editor/style-rtl.css 32.6 kB +13 B (+0.04%)
build/styles/editor/style-rtl.min.css 28.1 kB +18 B (+0.06%)
build/styles/editor/style.css 32.6 kB +11 B (+0.03%)
build/styles/editor/style.min.css 28.1 kB +19 B (+0.07%)

c98695d Run

⚡ Performance

Show the results

Client side metrics exclude the server response time.

front-end-block-theme

Metric 4cc572b add/navigation-remove-links-on-delete % Change
timeToFirstByte 45 ms +6.89% -4.44% 44.25 ms +15.37% -3.16% 1.69%
largestContentfulPaint 70 ms +2.86% -2.86% 72 ms +5.56% -5.56% -2.78%
lcpMinusTtfb 23.8 ms +15.13% -3.99% 24.65 ms +19.07% -7.71% -3.45%
wpBeforeTemplate 23.41 ms +9.95% -4.74% 23.25 ms +15.14% -1.76% 0.69%
wpTemplate 17.38 ms +7.59% -5.12% 17.38 ms +6.67% -4.55% 0%
wpTotal 41.85 ms +6.79% -4.9% 40.95 ms +15.7% -3.74% 2.2%
wpMemoryUsage 7.76 MB +0% -0% 7.76 MB +0% -0% 0.02%
wpDbQueries 16 +0% -0% 16 +0% -0% 0%

front-end-classic-theme

Metric 4cc572b add/navigation-remove-links-on-delete % Change
timeToFirstByte 36 ms +5.28% -2.36% 36.25 ms +10.21% -1.93% -0.69%
largestContentfulPaint 64 ms +3.13% -0% 64 ms +9.38% -0% 0%
lcpMinusTtfb 28.85 ms +1.56% -2.95% 28.4 ms +2.11% -4.4% 1.58%
wpBeforeTemplate 19.97 ms +6.11% -0.6% 20.08 ms +7.22% -0.3% -0.55%
wpTemplate 13 ms +3.38% -4.15% 13.43 ms +4.84% -6.25% -3.2%
wpTotal 33.25 ms +5.77% -2.26% 33.28 ms +11.66% -1.83% -0.09%
wpMemoryUsage 6.45 MB +0% -0% 6.45 MB +0% -0% 0.03%
wpDbQueries 13 +0% -0% 13 +0% -0% 0%

media-processing

Metric 4cc572b add/navigation-remove-links-on-delete % Change
mediaProcessingJpeg 323.52 ms +1.52% -0.28% 322.62 ms +0.56% -0.08% 0.28%
mediaProcessingAvif 4841.12 ms +0.09% -0.41% 4857.66 ms +0.26% -0.09% -0.34%
mediaProcessingJpegToAvif 3384.18 ms +0.03% -0.51% 3394.6 ms +0.14% -0.45% -0.31%

media-upload

Metric 4cc572b add/navigation-remove-links-on-delete % Change
jpegUploadProcessing 1458.6 ms +1.81% -0.46% 1452.66 ms +0.73% -0.78% 0.41%
pngUploadProcessing 237.31 ms +4.8% -5.2% 238.82 ms +5.84% -5.54% -0.63%
largeJpegUploadProcessing 1439.7 ms +0.67% -0.65% 1435.14 ms +0.52% -0.55% 0.32%
multipleImageUploadProcessing 1489 ms +0.95% -0.36% 1493.98 ms +0.5% -0.5% -0.33%

post-editor

Metric 4cc572b add/navigation-remove-links-on-delete % Change
serverResponse 324.95 ms +6.81% -9.69% 340.76 ms +2.27% -2.09% -4.64%
firstPaint 346.43 ms +3.75% -9.28% 343.71 ms +10.93% -6.36% 0.79%
domContentLoaded 685.66 ms +3.71% -1.95% 695.47 ms +0.94% -1.49% -1.41%
loaded 686.65 ms +3.72% -1.96% 696.72 ms +0.92% -1.49% -1.45%
firstContentfulPaint 386.6 ms +5.05% -2.47% 387.66 ms +4.89% -1.14% -0.27%
firstBlock 1843.38 ms +4.11% -1.31% 1878.2 ms +2.42% -0.65% -1.85%
type 16.35 ms +7.58% -10.4% 16.61 ms +8.37% -8.85% -1.57%
typeWithoutInspector 17.93 ms +3.79% -12.72% 16.42 ms +8.04% -9.07% 9.2%
typeWithTopToolbar 21.29 ms +6.72% -2.87% 20.57 ms +8.56% -3.55% 3.5%
typeContainer 7.21 ms +10.54% -4.85% 7.83 ms +2.3% -6.13% -7.92%
focus 94.7 ms +4.33% -6.88% 95.8 ms +1.98% -2.51% -1.15%
firstFocus 252.35 ms +0% -0% 230.39 ms +0% -0% 9.53%
selectAll 316.95 ms +1.74% -1.06% 335.63 ms +10.79% -2.87% -5.57%
undo 26.23 ms +8.31% -4.65% 26.36 ms +8.23% -4.63% -0.49%
listViewOpen 34.1 ms +6.42% -9.82% 33.41 ms +1.89% -7.06% 2.07%
inserterOpen 34.35 ms +13.07% -2.1% 33.09 ms +10.61% -2.48% 3.81%
inserterHover 9.86 ms +7.81% -6.69% 9.54 ms +16.04% -4.72% 3.35%
inserterSearch 7.25 ms +3.03% -6.07% 7.35 ms +5.44% -4.35% -1.36%
loadPatterns 538.2 ms +1.24% -2.54% 532.17 ms +3.92% -1.33% 1.13%
wpTotal 315.55 ms +7.21% -10.02% 332 ms +2.01% -2.14% -4.95%
wpMemoryUsage 14.81 MB +0% -0% 14.83 MB +0% -0% -0.08%
wpDbQueries 55 +0% -0% 55 +0% -0% 0%

site-editor

Metric 4cc572b add/navigation-remove-links-on-delete % Change
serverResponse 403.39 ms +3.87% -5.44% 409.87 ms +1.26% -6.12% -1.58%
firstPaint 454 ms +5.61% -10.89% 471.86 ms +0.76% -7.94% -3.79%
domContentLoaded 850.21 ms +2.85% -0.57% 848.99 ms +0.63% -1.17% 0.14%
loaded 851.37 ms +2.81% -0.56% 849.95 ms +0.61% -1.16% 0.17%
firstContentfulPaint 475.24 ms +4.97% -1.01% 472.96 ms +4.64% -0.74% 0.48%
firstBlock 2548.18 ms +4.34% -2.6% 2517.41 ms +1.16% -1.84% 1.22%
type 19.13 ms +7.68% -4.34% 18.96 ms +9.49% -13.45% 0.9%
navigate 120.64 ms +4.47% -3.75% 120.47 ms +8.52% -4.42% 0.14%
loadPatterns 1790.31 ms +2.22% -13.98% 1502.27 ms +6.9% -7.61% 19.17%
loadPages 951.67 ms +2.52% -2.61% 937.46 ms +2.43% -1.29% 1.52%
wpTotal 393.48 ms +3.74% -5.74% 400.15 ms +1.3% -6.31% -1.67%
wpMemoryUsage 12.85 MB +0% -0% 12.85 MB +0% -0% 0.01%
wpDbQueries 45 +0% -0% 45 +0% -0% 0%

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

templates can be registered and edited (Site Editor v2) in /test/e2e/specs/site-editor/template-registration.spec.js, passed after 1 failed attempt.
Error: expect(locator).toBeVisible() failed

Locator: getByText('AuthorGutenberg')
Expected: visible
Error: strict mode violation: getByText('AuthorGutenberg') resolved to 3 elements:
    1) <div data-wp-c16t="true" data-wp-component="Flex" class="_463056a1846babdd__flex eefcc0383f58d3a1__items-row _8a741740b23dfb57__expanded-row components-flex dataviews-view-grid__field">…</div> aka getByRole('row', { name: 'Row 1' }).getByText('AuthorGutenberg')
    2) <div data-wp-c16t="true" data-wp-component="Flex" class="_463056a1846babdd__flex eefcc0383f58d3a1__items-row _8a741740b23dfb57__expanded-row components-flex dataviews-view-grid__field">…</div> aka locator('[id="emptytheme//page"]').getByText('AuthorGutenberg')
    3) <div data-wp-c16t="true" data-wp-component="Flex" class="_463056a1846babdd__flex eefcc0383f58d3a1__items-row _8a741740b23dfb57__expanded-row components-flex dataviews-view-grid__field">…</div> aka locator('[id="emptytheme//plugin-template"]').getByText('AuthorGutenberg')

Call log:
  - Expect "toBeVisible" getByText('AuthorGutenberg') with timeout 5000ms
  - waiting for getByText('AuthorGutenberg')

    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/site-editor/template-registration.spec.js:60:55

c98695d Run

@jeryj
jeryj force-pushed the add/navigation-remove-links-on-delete branch from cca490b to 95ca50a Compare October 27, 2026 18:29
@jeryj
jeryj requested a review from spacedmonkey as a code owner October 27, 2026 18:29
@jeryj
jeryj force-pushed the add/navigation-auto-add-pages-publish-panel branch from c69f8b8 to 39587eb Compare October 27, 2026 18:29
@jeryj
jeryj force-pushed the add/navigation-remove-links-on-delete branch from 95ca50a to e16125a Compare October 27, 2026 18:59
@jeryj
jeryj requested a review from fabiankaegy as a code owner October 27, 2026 18:59
@jeryj
jeryj force-pushed the add/navigation-auto-add-pages-publish-panel branch from 39587eb to 7b923be Compare October 27, 2026 18:59
jeryj and others added 2 commits October 27, 2026 14:00
A page's pre-publish panel gains a "Menus" section listing the Navigation Menus that have "Auto add pages" switched on and will get a link to the page when it is published, each linking to the menu in the site editor. The check mirrors the server's: a menu that already links to the page is left out, and a child page is only listed for menus that link to its parent, naming the link it goes under.

The link opens the extensible site editor when its experiment is on, and the current site editor otherwise.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0199oMWAas4xDSnjTYeDtPxL
A menu that links to a draft page shows that link once the page is published, whether or not the menu adds pages itself, so the pre-publish panel lists it along with the menus that add a link.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0199oMWAas4xDSnjTYeDtPxL
@jeryj
jeryj force-pushed the add/navigation-remove-links-on-delete branch from e16125a to b2f5401 Compare October 27, 2026 19:00
@jeryj
jeryj force-pushed the add/navigation-auto-add-pages-publish-panel branch from 7b923be to ce97ed6 Compare October 27, 2026 19:00
jeryj and others added 5 commits November 24, 2026 13:43
…ion-auto-add-pages-publish-panel

# Conflicts:
#	packages/editor/CHANGELOG.md
Trunk now requires new files in the e2e tests to be TypeScript (#84829). Menus with "Auto add new pages" on are created through the REST API, since `createNavigationMenu()` takes only a title and content.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ion-auto-add-pages-publish-panel

# Conflicts:
#	packages/editor/CHANGELOG.md
@jeryj
jeryj marked this pull request as draft December 1, 2026 21:32

This branch has not been deployed

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

Labels

[Block] Navigation Affects the Navigation Block [Package] Editor /packages/editor [Type] Enhancement A suggestion for improvement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant