Command Palette: Make admin bar trigger a native group element#11171
Command Palette: Make admin bar trigger a native group element#11171ellatrix wants to merge 3 commits intoWordPress:trunkfrom
Conversation
Instead of adding the command palette as a regular node in root-default, register it as its own group under root. This makes it a sibling `<ul>` to root-default and top-secondary, allowing flexbox centering on `.quicklinks` without being constrained to the `<li>` node structure. - Add `command-palette` as a group with `add_group()`, place the trigger node inside it as `command-palette-trigger` - Convert `.quicklinks` to `display: flex` for layout control - Both side groups use `flex: 1 1 0; min-width: fit-content` so they share equal space but never shrink their content - Command palette group uses `flex: 0 0 auto` to sit centered between them naturally Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
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 Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
|
So the command palette is not accessible on mobile. Why shouldn't it be? |
|
It's the same as #11108, I don't think I changed anything there. I guess it will have to be added explicitly to the mobile version of the admin bar |
t-hamano
left a comment
There was a problem hiding this comment.
Thanks for the PR! When I actually saw the center-aligned search bar, I realized it was quite prominent 😅
There are two things that concern me.
- With several plugins installed, the search bar may become misaligned:

- When I open the editor, you may find the search bar overlapping, which can be a bit confusing:

Personally, I think going with #11160 might have the least impact. What do you think? cc @sabernhardt
I think that's fine, it still looks ok?
What o you mean here? What overlaps what?
Would need approval from design |
|
Something that looks like an input/search field but isn't one feels wrong.
They're not overlapping, but there are two of these bars right next to each other. |
Two approaches have been proposed that do not use a search bar in the first place. |

Trac: https://core.trac.wordpress.org/ticket/64672
Screen.Recording.2026-03-05.at.09.53.12.mov
Summary
Follow-up to #11108. Makes the command palette trigger a native admin bar group element instead of a regular node in
root-default, as suggested in review.command-paletteas its own group underrootusingadd_group(), with the trigger node inside it — this produces a sibling<ul>toroot-defaultandtop-secondary.quicklinkstodisplay: flexso the three groups lay out naturally: left items, centered command palette, right itemsflex: 1 1 0; min-width: fit-content— equal space when the viewport is wide (perfect centering), but they won't shrink below their content on narrow viewportsflex: 0 0 autobetween themExisting float declarations on
<li>elements become harmless (floats are ignored on flex items per CSS spec).Alternative approach
An alternative would be to bypass the node/group API entirely and render the command palette directly in
WP_Admin_Bar::_render()as a standalone<button>element — a sibling to the<ul>groups inside.quicklinks. This would give full control over the markup (semantic<button>instead of<a>inside<li>inside<ul>), but requires modifyingclass-wp-admin-bar.phpand hardcoding the element into the admin bar's render method. The group-based approach here is more straightforward since it reuses the existing API and keeps all the command palette logic inadmin-bar.php.Test plan
🤖 Generated with Claude Code