Repository navigation
Navigation: Give imported classic menus distinct titles - #85443
salvatorecorsi wants to merge 18 commits into
Conversation
🤖 PR meta 🤖🎉 PropsIf you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. Props Bot commandsYou can trigger Props Bot actions by commenting on this PR:
Updated as activity occurs, without notifying anyone named here. Add the 🏷️ LabelsThis pull request needs exactly one label indicating its type, and has 0.
Read more about Type labels in Gutenberg. If you cannot add labels yourself, a reviewer can do it for you. |
|
Could a maintainer rerun the current iOS job once? On |
What?
Closes #39200.
Give each newly imported classic menu an available Navigation menu title. Importing
Primarytwice createsPrimaryandPrimary 2instead of two Navigation menus namedPrimary.Why?
The classic-menu converter supplies the classic menu name to
useCreateNavigationMenu, which previously skipped the existing default-title generator whenever a name was supplied. Repeated imports therefore saved indistinguishable names. The existing automatic naming algorithm could also select an already used suffix when names had gaps.How?
Allow the title generator to receive a preferred title and use it for every Navigation menu creation. Wait for both draft and published menus, then select the first available exact title using numeric suffixes. Names that merely share a prefix do not cause a collision. Existing template-area naming, preview behavior, block serialization, post status and save flow are preserved; manually renaming an existing menu is unaffected.
The regression tests exercise the real classic-menu converter, creation hook, title generator and core-data registry, with mocked REST transport at the boundary. They cover sequential imports, draft and published collisions, suffix gaps, literal numeric suffixes, escaped titles, asynchronous resolution, template-area fallback and preview/error controls.
Testing Instructions
Primarywith at least one link.Primaryunder Import Classic Menus.PrimaryandPrimary 2) and retain the same links.Primary,Primary 2andPrimary 4already present as draft or published Navigation menus, repeat the import and confirm the new name isPrimary 3.Testing Instructions for Keyboard
Select the Navigation block, use Tab to reach its menu selector and press Enter. Use the arrow keys to choose the classic menu under Import Classic Menus and press Enter. Repeat the import and check the distinct menu names. No controls or keyboard handlers are changed by this patch.
Automated validation
The final regression file against unchanged source: six expected failures for missing naming/resolution behavior, with four unchanged controls passing. The same test file passes after the fix.
npm run test:unit -- packages/block-library/src/navigation --sequence.seed=190023: 19 files and 232 tests pass.npm run test:unit:conventions: passes.Changed-file
npm run lint:js: passes.npm run typecheck -- packages/block-library/tsconfig.json: passes.npm run build: passes.After merging trunk on October 24, the Navigation suite, changed-file lint, block-library typecheck, changelog validation and full build pass again. The Entity Fields/Actions API, REST controller and preload subset also passes on native PHP 8.3 (219 tests); this does not substitute for the Linux PHP 7.4 CI job.
Native Chromium before the October 24 trunk merge: two actual Navigation dropdown imports in the post editor created distinct saved titles and identical link content through real REST requests. Both retained the existing stored draft / edited publish status behavior. The owned fixtures were deleted and original posts, post metadata, terms, relationships, comments, comment metadata and editor preferences were checked against the final run's snapshot.
The October 24 normal merge includes upstream #85390, which updates the Entity Fields/Actions compatibility layer for the Core API change in Core #14716. The Navigation implementation and its regression tests are unchanged. The same Site Editor crash also appears in the old trunk comparison baseline of a separate performance run; the template-switching E2E failure remains under investigation.
No Docker E2E or full repository test-suite result is claimed.
Maintainer action
Please apply
[Type] Bugwhen reviewing this bug fix. Enforce labels requires exactly one[Type]label; the contributor account has read access and cannot apply it.Validation after trunk update (2026-11-02)
Merged trunk
66fa56fff04be859c093813a4ef9578f918525f9normally and validated head21cf1ec66c8468a6e5dceb63cde47d135b86f339.Conflict-free normal merge of current trunk66fa56f after the c6 update; no owned source or assertion changes. The initial hosted browser connection-closed log and all prior validation are preserved in phase1.
The earlier native PHP Entity Fields/Actions/controller/preload result (206 tests and 901 assertions) is preserved as historical evidence; it was not rerun for this dependency/UI-only upstream merge.
An extra exploratory browser-only Navigation filter selected no files and failed explicitly; Navigation/Navigation Link coverage is the successful Node/jsdom run above. The dedicated Notices Chromium run selected and passed its real 14 cases.
Chromium output retains the non-fatal upstream PostCSS missing-from warning.
The required type label still needs maintainer action.
Validation update — 9 November 2026
Merged trunk
afa2c6a9baec79a4fdfb40ca59adaae410cc5feband validated published headd4bb4d26f0ead8df14803f52853db263b1f3d8ca. This includes the required trunk baseline.These are local validation results; hosted CI and maintainer-only label requirements remain separate.
Historical branch update — 24 November 2026
Merged upstream trunk
72e50c65901120eadcac90b97940466713fbe37bto resolve the actual conflict. The original source and regression-test contribution is retained. Upstream release sections are preserved, with this PR's notes only in the current Unreleased categories, after upstream notes.Fresh validation on published head
e7d40722a2dc6fa32ff9093fdb8269b7c707324d: own dependency installation, production build, PR changelog validation, full repository typecheck, the scoped lint/static-analysis checks, test conventions, tsconfig validation, generated-documentation checks passed. 10 focused test executions passed across 1 test file.These are scoped checks, not a full repository or Docker E2E pass. Earlier native-browser/provider evidence remains historical; native browser/site checks were not rerun for this merge. Hosted CI and maintainer-only metadata checks are separate from these local results.
Previous branch update (historical) — 24 November 2026 (current trunk f7aa30a)
Merged upstream trunk
f7aa30a92cc1264543a31c1dd649a68eb39ed123to resolve the actual package-changelog conflict. The original source and regression-test contribution is retained. Upstream release sections are preserved, with this PR's notes only in the current Unreleased categories, after upstream notes.Fresh validation on published head
aa7906c8c074f424eac9890c09b5744f89c2cf7d: own fresh dependency installation, production build, PR changelog validation, full repository typecheck, the scoped lint/static-analysis checks, test conventions, tsconfig validation, generated-documentation checks passed. 10 focused test executions passed across 1 test-file executions.These are scoped checks, not a full repository or Docker E2E pass. No native WordPress browser/site verification was rerun for this merge; earlier browser/site evidence remains historical. Hosted CI and maintainer-only metadata checks are separate from these local results.
Test isolation follow-up — 24 November 2026
The shuffled CI run caught an extra REST call in the disabled-preview test. A controlled queue probe showed pending saved-menu reads from the earlier import fixture. The fixture now returns a real
Responsefor those reads and awaits their resolution when checking the edited publish status, so that work finishes before the next test resets the shared API mock. Production hooks and the disabled-preview assertions are unchanged.Fresh validation on
6a00aca68ed78c700ac73a016a91f90362d12e87: the ten regression cases passed with shuffled seeds199294and20261124and in normal order. Production build, full repository typecheck, scoped lint, test conventions, tsconfig, changelog and generated-documentation checks passed. All applicable upstream pre-commit tasks also passed serially with hooks enabled.These local runs used Node 24.20 on Windows; the original Node 26/Linux shard was not rerun locally. The controlled probe failed with the earlier synchronous assertion and passed when resolution was awaited. Fresh hosted CI on this head remains separate from these local checks.
Historical branch update — 25 November 2026 (earlier trunk)
Merged upstream trunk
6b90259aefc965729b972fe226d7c22ecc295823to resolve the actual merge conflicts. The original source and regression-test contribution is retained. Upstream release sections are preserved, with this PR's notes only in the current Unreleased categories, after upstream notes.Fresh validation on published head
49a481e1c89415d248b9600874bc6c423afb54a5: verified reuse of this checkout’s isolated dependency installation, production build, PR changelog validation, full repository typecheck, the scoped lint/static-analysis checks, test conventions, tsconfig validation, generated-documentation checks passed. 30 focused test executions passed across 3 test-file executions.These are scoped checks, not a full repository functional-suite or Docker E2E pass. No native WordPress browser/site verification was rerun for this merge; earlier browser/site evidence remains historical. Hosted CI and maintainer-only metadata checks are separate from these local results.
Branch update — 26 November 2026 (startup trunk b173246)
Merged upstream trunk
b17324644dd5dffa49fa08c24f1c3523cac3a6a1to resolve the actual merge conflicts. The original source and regression-test contribution is retained. Upstream release sections are preserved, with this PR's notes only in the current Unreleased categories, after upstream notes.Fresh validation on published head
0a4c7b41c2f24d8168e53e12e131335c6a4f439a: fresh isolated npm and Composer installation, production build, PR changelog validation, full repository typecheck, the scoped lint/static-analysis checks, test conventions, tsconfig validation, generated-documentation checks passed. 30 focused test executions passed across 3 test-file executions.These are scoped checks, not a full repository functional-suite or Docker E2E pass. No native WordPress browser/site verification was rerun for this merge; earlier browser/site evidence remains historical. Hosted CI and maintainer-only metadata checks are separate from these local results.
Earlier validation — 27 November 2026 (captured trunk fd1bc1d)
Published head
3a8f4b88dade130283a0c27aa5e89065046e7d44includes a normal merge of captured trunkfd1bc1d87f2c37abe9a49b3d1ac3084b5b5a1671to resolve the actual package changelog conflict. Upstream release notes and this PR's original source/test contribution are preserved.Fresh checks on this merged tree passed: the production build, full repository typecheck, dependency/lockfile lint, documentation generation, whitespace checks, scoped JavaScript lint, test conventions, TypeScript configuration lint. The same 10-case Navigation hook suite passed in three planned test orderings (30 test executions, with overlap). The checkout's own dependencies were freshly installed and their inputs and workspace links verified.
The scoped changelog checks passed. The scoped published-dependency checks passed using the documented Windows junction adapter; these do not constitute the default full audit.
This merge-only commit used
HUSKY=0after the separate current-tree checks; earlier source-hook results retain their original heads. No fresh native WordPress browser verification or Docker E2E run is claimed. Hosted CI for this new head is separate from the local results.Current validation — 28 November 2026
Published head
927c6561a0fd0cc601acc840d76f602228e62b36includes a normal merge of captured trunk48c4df2d3c1323c0cffeed9f85702df7187f9d43to resolve the package changelog conflicts. The original production contribution is retained exactly relative to the new base. The Navigation unit-test setup now marks the currentgetEntityConfigresolution for['postType', '']complete after providing its fixture entities. This prevents an unrelated/types?context=viewbootstrap request from blocking the deliberately delayed menu requests or polluting their request counts; the existing assertions are unchanged. Upstream release text is preserved, and this PR's entries follow upstream entries under Unreleased.This checkout's own npm and Composer dependencies were installed for the current inputs. The production build and full repository typecheck passed. Passing checks also include scoped source lint and documentation generation.
The selected JavaScript/Browser Mode groups passed 30 test executions across 3 file executions; overlapping groups are counted as executions.
Scoped published-dependency checks with the Windows junction adapter reported zero findings. These are separate scoped results; the default full audit was not run.
This normal merge commit used
HUSKY=0after the separate current-tree checks. Codex performed this maintenance and automated verification. Hosted CI and maintainer-only metadata requirements are tracked separately.Earlier native-browser evidence retains its original head and scope. No fresh native WordPress browser run is claimed for this update.
These are scoped functional checks; no full repository functional-suite or Docker E2E pass is claimed.
Use of AI Tools
Codex also performed the branch maintenance and automated validation dated above.
OpenAI Codex selected and investigated the issue, authored the implementation and tests, ran automated validation and prepared this PR. A separate Codex agent reviewed the patch. The repository owner has not performed a human code review; maintainer review is still required.