Hide navigation commands that match the current screen context - #80116
Hide navigation commands that match the current screen context#80116sarthaknagoshe2002 wants to merge 1 commit into
Conversation
|
Warning: Type of PR label mismatch To merge this PR, it requires exactly 1 label indicating the type of PR. Other labels are optional and not being checked here.
Read more about Type labels in Gutenberg. Don't worry if you don't have the required permissions to add labels; the PR reviewer should be able to help with the task. |
|
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. |
What?
Closes #71925
This PR hides redundant "Go to [location]" commands from the Command Palette if the user is already currently viewing that specific screen or context.
Why?
Previously, the Command Palette statically registered all global navigation commands regardless of the user's current location. If a user was already on the Navigation screen, the palette would still suggest "Go to Navigation." This created unnecessary visual clutter and reduced the contextual usefulness of the palette by suggesting actions that had no effect.
How?
admin-navigation-commands.jsto parse generic menu URLs and filter out any commands where the target pathname and query string exactly match the browser's currentwindow.location.isSameSiteEditorPath()helper insite-editor-navigation-commands.jsto determine the active Site Editor view.Testing Instructions
Screenshots or screencast
Screen.Recording.2026-07-10.at.8.27.24.PM.mov