#61615 closed defect (bug) (fixed)
Toolbar: consider moving user menu to a higher priority (after most plugins)
Reported by: | sabernhardt | Owned by: | hellofromTonya |
---|---|---|---|
Milestone: | 6.6.1 | Priority: | normal |
Severity: | normal | Version: | 6.6 |
Component: | Toolbar | Keywords: | has-patch dev-reviewed commit fixed-major has-dev-note |
Focuses: | Cc: |
Description
With [58215], the placement of admin bar items in the top-secondary
group have a different visual order. The search form is moved to the end, but the user menu and recovery mode nodes from Core could be set a later priority so plugin links stay to the left of them.
@pbiron shared screenshots in a comment on the dev note. They show of a set of multiple secondary nodes in a 6.5.5 site and how they look in 6.6.
@joemcgill suggested increasing the priority of the user menu on Slack.
Attachments (1)
Change History (23)
#1
follow-up:
↓ 7
@
5 months ago
I chose priorities close to the Search form's 9999
but wanted a few numbers for extenders to target a spot between them.
This ticket was mentioned in Slack in #accessibility by sabernhardt. View the logs.
5 months ago
#3
@
5 months ago
thanx @sabernhardt. The patch looks good.
Having the nodes that core adds to top-secondary
group more to the right (where they used to be, but now in DOM order) is good!
#4
@
5 months ago
- Milestone changed from Awaiting Review to 6.6.1
- Owner set to joedolson
- Status changed from new to accepted
I'm going to go ahead and milestone this for 6.6.1. If it weren't so close to release, I'd want to get it in for 6.6, so it makes sense to me that this should be considered a bug.
#7
in reply to:
↑ 1
@
5 months ago
Is it possible to just reverse the order when rendering? Changing the order seems to be a breaking change and affects the existing behavior as well. For example, if a plugin adds the nodes to the admin bar in sequence, the order of those nodes will be changed after WP 6.6.
- Before: | 3 | 2 | 1 | - due to the
float: right
- After: | 1 | 2 | 3 |
This ticket was mentioned in Slack in #core by hellofromtonya. View the logs.
5 months ago
#9
@
5 months ago
6.6.1 RC will likely happen late tomorrow, July 18th (no time is set yet).
During today's scrub, @joedolson noted to look at it later tonight for commit. On my review list for backporting to 6.6 branch.
#10
@
5 months ago
- Keywords reviewing added
@arthur791004 I wouldn't consider a change in order a breaking change; there may be some special cases where the apparent order of items makes a significant difference, but mostly not. Reversing the order when adding nodes would result in a confusing and non-intuitive use of a common and standard WordPress API, so I think it's better that extenders update their code to accommodate the new order.
#12
@
5 months ago
- Resolution set to fixed
- Status changed from accepted to closed
Commit action doesn't seem to have run.
=====
Toolbar: Move user and recovery menus to a higher priority.
Following [58215], admin bar items in the top-secondary group have a changed visual order. Increase the priority of the user and recovery menu items so nodes added with higher priorities will still be shown visually before the user and recovery menu items, as they were prior to 58215.
The items will appear in the reverse of the previous order, but the new order now matches their priority order, rather than being the opposite.
Props sabernhardt, joemcgill, pbiron, joedolson.
Fixes #61615.
#13
@
5 months ago
- Keywords dev-feedback added; commit removed
- Resolution fixed deleted
- Status changed from closed to reopened
Reopening for backport to 6.6.1.
#14
@
5 months ago
- Keywords dev-reviewed commit added; dev-feedback removed
- Owner changed from joedolson to hellofromTonya
- Status changed from reopened to reviewing
[58748] LGTM for backport to the 6.6 branch for 6.6.1.
Doing backport commit now.
#17
@
5 months ago
I have this in my theme:
function theme_slug_replace_howdy( $wp_admin_bar ) { $my_account = $wp_admin_bar->get_node( 'my-account' ); $wp_admin_bar->add_node( array( 'id' => 'my-account', 'title' => str_replace( 'Howdy,', 'Hello,', $my_account->title ), ) ); } add_action( 'admin_bar_menu', 'theme_slug_replace_howdy', 25 );
After 6.6.1 release I am getting following PHP warnings.
PHP Warning: Attempt to read property "title" on null in /Users/nilambarsharma/Sites/staging/app/public/wp-content/themes/khai/functions.php on line 45 PHP Deprecated: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in /Users/nilambarsharma/Sites/staging/app/public/wp-content/themes/khai/functions.php on line 45
I noticed priority of this hook has been changed in the above commit. PHP notice is fixed when I keep priority 9999
for my custom hook in my theme. Just reporting here because I am not sure whether this issue should be fixed in core or in my theme.
#18
@
5 months ago
Hi @rabmalin,
You are correct the same thing is already reported here.
https://core.trac.wordpress.org/ticket/61738
When these priorities changed we are getting null for the given node.
$wp_admin_bar->get_node( 'my-account' )
#19
@
3 months ago
- Keywords needs-dev-note added
As discussed in #61738, a dev note is needed to document this change and to provide guidance to extenders.
#20
@
3 months ago
My draft for the dev note seems ready for review.
This ticket was mentioned in Slack in #core by hellofromtonya. View the logs.
3 months ago
#22
@
3 months ago
- Keywords has-dev-note added; needs-dev-note removed
Dev note is now published https://make.wordpress.org/core/2024/09/10/admin-toolbar-menu-has-new-higher-priority-values/
moves user menu and recovery mode nodes from priority levels
7
and8
to9991
and9992