Repository navigation
Navigation: Add draft status indicator and publish action - #83951
Open
sarthaknagoshe2002 wants to merge 1 commit into
Open
sarthaknagoshe2002 wants to merge 1 commit into
sarthaknagoshe2002 wants to merge 1 commit 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. 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. |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What?
Closes #67194
This PR adds a clear UI indicator and a one click publish action to the Navigation block when it references a
wp_navigationpost that is in adraftstate.Why?
Users frequently experience a situation where they build a menu in the editor, but it mysteriously disappears on the frontend because the underlying
wp_navigationpost is still a draft. Since there is currently no feedback in the editor, users often assume their theme is broken or recreate menus unnecessarily. This PR prevents that confusion by clearly surfacing the draft status and providing an immediate way to publish it.How?
(Draft)text label next to the menu items in the editor canvas. It only renders when the parent block or a child inner-block is selected (isSelected || hasSelectedInnerBlock), avoiding layout flicker while users edit individual links.<Notice>in the sidebar explaining the draft state.usePublishNavigationMenuhook.speak()to announce the successful publication.Design & Scope Decisions:
<body>, but thespeak()function ensures the success state is properly announced to screen readers.Testing Instructions
wp post create --post_type=wp_navigation --post_status=draft --post_title="Test Draft Menu"(Draft)label appears safely next to the menu items without breaking the flex layout.Screenshots or screencast
Use of AI Tools
This PR was authored with assistance from Gemini for architectural analysis of Gutenberg data hooks. All generated code was manually verified and tested.