Skip to content

Toolbar command palette: icon link#11160

Open
sabernhardt wants to merge 13 commits intoWordPress:trunkfrom
sabernhardt:toolbar-command-palette-icon-link
Open

Toolbar command palette: icon link#11160
sabernhardt wants to merge 13 commits intoWordPress:trunkfrom
sabernhardt:toolbar-command-palette-icon-link

Conversation

@sabernhardt
Copy link

@sabernhardt sabernhardt commented Mar 4, 2026

Adds a node to the admin toolbar to open the Command Palette. It uses the same magnifying glass icon from the Search form, in the same place.

Trac 64672

Use of AI Tools: None (by me)

Screengrab

Screen.Recording.2026-03-04.at.16.21.25.mov

This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.

@github-actions
Copy link

github-actions bot commented Mar 4, 2026

Test using WordPress Playground

The changes in this pull request can previewed and tested using a WordPress Playground instance.

WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser.

Some things to be aware of

  • All changes will be lost when closing a tab with a Playground instance.
  • All changes will be lost when refreshing the page.
  • A fresh instance is created each time the link below is clicked.
  • Every time this pull request is updated, a new ZIP file containing all changes is created. If changes are not reflected in the Playground instance,
    it's possible that the most recent build failed, or has not completed. Check the list of workflow runs to be sure.

For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation.

Test this pull request with WordPress Playground.

Copy link
Author

@sabernhardt sabernhardt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As @westonruter suggested on the ticket, this uses the search icon in an element to open the command palette dialog.

At 31 pixels wide, it could start to break the top level, but it is not as demanding as trying to fit a fake search box that opens a real search field further down the page.

add_action( 'admin_bar_menu', 'wp_admin_bar_my_account_item', 9991 );
add_action( 'admin_bar_menu', 'wp_admin_bar_recovery_mode_menu', 9992 );
add_action( 'admin_bar_menu', 'wp_admin_bar_search_menu', 9999 );
add_action( 'admin_bar_menu', 'wp_admin_bar_command_palette_menu', 9999 );
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is separate from the Search node in case someone wants to disable one and keep the other, but it is set at the same priority.

@westonruter
Copy link
Member

As per this comment, this would also enable the Command Palette to be made available to mobile form factors.

@westonruter
Copy link
Member

I added a screengrab to the description.

Also, suggested patch to show the search icon on mobile:

--- a/src/wp-includes/css/admin-bar.css
+++ b/src/wp-includes/css/admin-bar.css
@@ -1031,7 +1031,8 @@ html:lang(he-il) .rtl #wpadminbar * {
 	#wpadminbar li#wp-admin-bar-new-content,
 	#wpadminbar li#wp-admin-bar-edit,
 	#wpadminbar li#wp-admin-bar-comments,
-	#wpadminbar li#wp-admin-bar-my-account {
+	#wpadminbar li#wp-admin-bar-my-account,
+	#wpadminbar li#wp-admin-bar-command-palette {
 		display: block;
 	}

@westonruter
Copy link
Member

westonruter commented Mar 5, 2026

It would be nice to promote the ⌘K/^K shortcut somehow as well so a user can learn they don't have to actually click on 🔍 to open the Command Palette.

@sabernhardt sabernhardt marked this pull request as ready for review March 5, 2026 15:16
@github-actions
Copy link

github-actions bot commented Mar 5, 2026

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.

Core Committers: Use this line as a base for the props when committing in SVN:

Props sabernhardt, wildworks, westonruter.

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

@westonruter
Copy link
Member

Here's a couple screen recordings with the latest changes:

Desktop

Screen.Recording.2026-03-05.at.09.24.07.mov

Mobile

Screen.Recording.2026-03-05.at.09.22.35.mov

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants