-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Fix Navigation Block default link consistency across all insertion methods #71899
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…k attributes - Update AddSubmenuItem to use DEFAULT_BLOCK.name and DEFAULT_BLOCK.attributes - Ensures List View sidebar creates page-type links instead of custom links - Maintains consistency with in-canvas InnerBlocks and Add block inserter
…attributes - Import DEFAULT_BLOCK from Navigation Block constants - Remove local DEFAULT_BLOCK definition that was missing attributes - Ensures Navigation Submenu Add block inserter creates page-type links - Maintains consistency with main Navigation Block behavior
|
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 If 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. |
|
Size Change: -2 B (0%) Total Size: 1.95 MB
ℹ️ View Unchanged
|
|
Flaky tests detected in adbb0e6. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/18008358739
|
|
Might be worth adding a smoke e2e test as a follow up to verify that the same default block is inserted across all places where it's possible to insert blocks within the Nav block. |
jeryj
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested on trunk and saw that it created a custom link. Tried on your branch, and it correctly creates a page link by default, bringing the top level and submenu links in line with each other.
| getNavigationChildBlockProps, | ||
| } from '../navigation/edit/utils'; | ||
| import { useToolsPanelDropdownMenuProps } from '../utils/hooks'; | ||
| import { DEFAULT_BLOCK } from '../navigation/constants'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The duplicate files of extremely similar components strikes again! Importing this constant is a better way of handling it than hoping we remember (we don't, and it causes bugs).
What
Fixes inconsistent default link creation across Navigation Block insertion methods. Previously, List View 'Add submenu link' and Navigation Submenu InnerBlocks were creating custom links instead of page-type links.
Why
The Navigation Block system had inconsistent behaviour when adding new links:
kind: 'post-type'andtype: 'page'This inconsistency created a confusing user experience where the same action produced different results depending on the insertion method.
Thanks to upgrades to the Link UI to include the
Add blockUX, users can now easily access other Nav Link block variations / other block types. As a result we can safetly normalize the insertion of Page variation as the default experience.How
AddSubmenuItemin Navigation Block to useDEFAULT_BLOCK.nameandDEFAULT_BLOCK.attributesDEFAULT_BLOCKconfigurationDEFAULT_BLOCKdefinition that was missing proper attributesTesting
Screenshots
Screen.Capture.on.2025-09-25.at.14-05-36.mp4