Skip to content

Hide navigation commands that match the current screen context - #80116

Open
sarthaknagoshe2002 wants to merge 1 commit into
WordPress:trunkfrom
sarthaknagoshe2002:fix/issue-71925
Open

Hide navigation commands that match the current screen context#80116
sarthaknagoshe2002 wants to merge 1 commit into
WordPress:trunkfrom
sarthaknagoshe2002:fix/issue-71925

Conversation

@sarthaknagoshe2002

Copy link
Copy Markdown
Contributor

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?

  • Updated admin-navigation-commands.js to parse generic menu URLs and filter out any commands where the target pathname and query string exactly match the browser's current window.location.
  • Added a new isSameSiteEditorPath() helper in site-editor-navigation-commands.js to determine the active Site Editor view.

Testing Instructions

  1. Go to admin/editor area in your site.
  2. Navigate to areas like Navigation, Template, Pages, Template parts, Dashboard, etc.
  3. Open the Command Palette (Cmd + K / Ctrl + K).
  4. Search for same areas again.

Screenshots or screencast

Screen.Recording.2026-07-10.at.8.27.24.PM.mov

@sarthaknagoshe2002
sarthaknagoshe2002 marked this pull request as ready for review July 10, 2026 17:08
@github-actions

Copy link
Copy Markdown

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.

  • Required label: Any label starting with [Type].
  • Labels found: [Package] Core commands.

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.

@github-actions

Copy link
Copy Markdown

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 props-bot label.

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: sarthaknagoshe2002 <sarthaknagoshe2002@git.wordpress.org>
Co-authored-by: t-hamano <wildworks@git.wordpress.org>
Co-authored-by: kjnanda <krupajnanda@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Command Palette shows redundant commands for current context

1 participant