Make WordPress Core

Opened 4 weeks ago

Closed 3 weeks ago

Last modified 12 days ago

#61615 closed defect (bug) (fixed)

Toolbar: consider moving user menu to a higher priority (after most plugins)

Reported by: sabernhardt's profile sabernhardt Owned by: hellofromtonya's profile hellofromTonya
Milestone: 6.6.1 Priority: normal
Severity: normal Version: 6.6
Component: Toolbar Keywords: has-patch dev-reviewed commit fixed-major
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)

61615.diff (777 bytes) - added by sabernhardt 4 weeks ago.
moves user menu and recovery mode nodes from priority levels 7 and 8 to 9991 and 9992

Download all attachments as: .zip

Change History (19)

@sabernhardt
4 weeks ago

moves user menu and recovery mode nodes from priority levels 7 and 8 to 9991 and 9992

#1 follow-up: @sabernhardt
4 weeks 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.


4 weeks ago

#3 @pbiron
4 weeks 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 @joedolson
4 weeks 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.

#5 @pbiron
3 weeks ago

  • Keywords needs-patch added

#6 @pbiron
3 weeks ago

  • Keywords has-patch added; needs-patch removed

#7 in reply to: ↑ 1 @arthur791004
3 weeks 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.


3 weeks ago

#9 @hellofromTonya
3 weeks 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 @joedolson
3 weeks 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.

#11 @joedolson
3 weeks ago

  • Keywords commit added; reviewing removed

#12 @joedolson
3 weeks ago

  • Resolution set to fixed
  • Status changed from accepted to closed

Commit action doesn't seem to have run.
=====

[58748]:

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.

Last edited 3 weeks ago by hellofromTonya (previous) (diff)

#13 @joedolson
3 weeks ago

  • Keywords dev-feedback added; commit removed
  • Resolution fixed deleted
  • Status changed from closed to reopened

Reopening for backport to 6.6.1.

#14 @hellofromTonya
3 weeks 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.

#15 @hellofromTonya
3 weeks ago

  • Resolution set to fixed
  • Status changed from reviewing to closed

In 58759:

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.

Reviewed by hellofromTonya.
Merges [58748] to the 6.6 branch.

Props sabernhardt, joemcgill, pbiron, joedolson.
Fixes #61615.

#16 @hellofromTonya
13 days ago

  • Keywords fixed-major added

#17 @rabmalin
12 days 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 @narenin
12 days 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' )


Note: See TracTickets for help on using tickets.