Toolbar: Polish design and code combining duplicate profile links.

Fixes some design changes and improves quality of comments and code styles following previous changes. Follow-up to [57708].

Props sabernhardt, huzaifaalmesbah, joedolson.
Fixes #43633. See #34668.
Built from https://develop.svn.wordpress.org/trunk@57765


git-svn-id: http://core.svn.wordpress.org/trunk@57266 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
joedolson 2024-03-04 21:50:11 +00:00
parent 6e31cd8f9a
commit 1d4d8917f7
7 changed files with 16 additions and 22 deletions

View File

@ -139,7 +139,7 @@ function wp_admin_bar_wp_menu( $wp_admin_bar ) {
__( 'About WordPress' ) . __( 'About WordPress' ) .
'</span>', '</span>',
'href' => $about_url, 'href' => $about_url,
'meta' => array( 'meta' => array(
'menu_title' => __( 'About WordPress' ), 'menu_title' => __( 'About WordPress' ),
), ),
); );
@ -286,7 +286,9 @@ function wp_admin_bar_my_account_item( $wp_admin_bar ) {
'href' => $profile_url, 'href' => $profile_url,
'meta' => array( 'meta' => array(
'class' => $class, 'class' => $class,
/* translators: %s: Current user's display name. */
'menu_title' => sprintf( __( 'Howdy, %s' ), $current_user->display_name ), 'menu_title' => sprintf( __( 'Howdy, %s' ), $current_user->display_name ),
'tabindex' => ( false !== $profile_url ) ? '' : 0,
), ),
) )
); );
@ -329,7 +331,9 @@ function wp_admin_bar_my_account_menu( $wp_admin_bar ) {
$user_info .= "<span class='username'>{$current_user->user_login}</span>"; $user_info .= "<span class='username'>{$current_user->user_login}</span>";
} }
$user_info .= "<span class='edit-profile'>" . __( 'Edit Profile' ) . '</span>'; if ( false !== $profile_url ) {
$user_info .= "<span class='display-name edit-profile'>" . __( 'Edit Profile' ) . '</span>';
}
$wp_admin_bar->add_node( $wp_admin_bar->add_node(
array( array(
@ -389,7 +393,7 @@ function wp_admin_bar_site_menu( $wp_admin_bar ) {
'id' => 'site-name', 'id' => 'site-name',
'title' => $title, 'title' => $title,
'href' => ( is_admin() || ! current_user_can( 'read' ) ) ? home_url( '/' ) : admin_url(), 'href' => ( is_admin() || ! current_user_can( 'read' ) ) ? home_url( '/' ) : admin_url(),
'meta' => array( 'meta' => array(
'menu_title' => $title, 'menu_title' => $title,
), ),
) )
@ -990,7 +994,7 @@ function wp_admin_bar_new_content_menu( $wp_admin_bar ) {
'id' => 'new-content', 'id' => 'new-content',
'title' => $title, 'title' => $title,
'href' => admin_url( current( array_keys( $actions ) ) ), 'href' => admin_url( current( array_keys( $actions ) ) ),
'meta' => array( 'meta' => array(
'menu_title' => _x( 'New', 'admin bar menu group label' ), 'menu_title' => _x( 'New', 'admin bar menu group label' ),
), ),
) )

View File

@ -506,7 +506,7 @@ class WP_Admin_Bar {
* @since 6.5.0 Added `$menu_title` parameter to allow an ARIA menu name. * @since 6.5.0 Added `$menu_title` parameter to allow an ARIA menu name.
* *
* @param object $node * @param object $node
* @param string|bool $menu_title The accessible name of this aria menu or false if not provided. * @param string|bool $menu_title The accessible name of this ARIA menu or false if not provided.
*/ */
final protected function _render_group( $node, $menu_title = false ) { final protected function _render_group( $node, $menu_title = false ) {
if ( 'container' === $node->type ) { if ( 'container' === $node->type ) {

View File

@ -188,7 +188,7 @@ html:lang(he-il) .rtl #wpadminbar * {
#wpadminbar.nojs .quicklinks .menupop:hover ul li .ab-item, #wpadminbar.nojs .quicklinks .menupop:hover ul li .ab-item,
#wpadminbar .shortlink-input { #wpadminbar .shortlink-input {
line-height: 2; line-height: 2;
height: 26px; height: 1.625rem;
white-space: nowrap; white-space: nowrap;
min-width: 140px; min-width: 140px;
} }
@ -448,11 +448,6 @@ html:lang(he-il) .rtl #wpadminbar * {
background: none; background: none;
} }
#wpadminbar #wp-admin-bar-user-info a {
display: grid;
row-gap: 12px;
}
#wp-admin-bar-user-info .avatar { #wp-admin-bar-user-info .avatar {
position: absolute; position: absolute;
right: -72px; right: -72px;
@ -469,7 +464,7 @@ html:lang(he-il) .rtl #wpadminbar * {
#wpadminbar #wp-admin-bar-user-info span { #wpadminbar #wp-admin-bar-user-info span {
background: none; background: none;
padding: 0; padding: 0;
height: 18px; height: 1.125rem;
} }
#wpadminbar #wp-admin-bar-user-info .display-name, #wpadminbar #wp-admin-bar-user-info .display-name,

File diff suppressed because one or more lines are too long

View File

@ -187,7 +187,7 @@ html:lang(he-il) .rtl #wpadminbar * {
#wpadminbar.nojs .quicklinks .menupop:hover ul li .ab-item, #wpadminbar.nojs .quicklinks .menupop:hover ul li .ab-item,
#wpadminbar .shortlink-input { #wpadminbar .shortlink-input {
line-height: 2; line-height: 2;
height: 26px; height: 1.625rem;
white-space: nowrap; white-space: nowrap;
min-width: 140px; min-width: 140px;
} }
@ -447,11 +447,6 @@ html:lang(he-il) .rtl #wpadminbar * {
background: none; background: none;
} }
#wpadminbar #wp-admin-bar-user-info a {
display: grid;
row-gap: 12px;
}
#wp-admin-bar-user-info .avatar { #wp-admin-bar-user-info .avatar {
position: absolute; position: absolute;
left: -72px; left: -72px;
@ -468,7 +463,7 @@ html:lang(he-il) .rtl #wpadminbar * {
#wpadminbar #wp-admin-bar-user-info span { #wpadminbar #wp-admin-bar-user-info span {
background: none; background: none;
padding: 0; padding: 0;
height: 18px; height: 1.125rem;
} }
#wpadminbar #wp-admin-bar-user-info .display-name, #wpadminbar #wp-admin-bar-user-info .display-name,

File diff suppressed because one or more lines are too long

View File

@ -16,7 +16,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '6.5-beta3-57764'; $wp_version = '6.5-beta3-57765';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.