Skip to content

Toolbar: Fix the display name live preview and "Howdy" color - #14275

Closed
fushar wants to merge 3 commits into
WordPress:trunkfrom
fushar:howdy-fix-color
Closed

fushar wants to merge 3 commits into
WordPress:trunkfrom
fushar:howdy-fix-color

Conversation

@fushar

@fushar fushar commented Oct 14, 2026 •

Copy link
Copy Markdown

Trac ticket: https://core.trac.wordpress.org/ticket/66222

Summary

This PR contains two follow-ups to moving "Howdy" into the user menu (#13681). The fixes are very closely related so I'm making both changes in this single PR.

  • "Howdy" color: I just found out that some custom plugins' admin color schemes only color #wp-admin-bar-user-info .display-name in their CSS, so the display name gets the scheme's color but the "Howdy, " text doesn't. This PR adds the display-name class to the greeting wrapper (<span class="display-name howdy">).

  • Display name live preview: when the display name dropdown is changed on the profile page, the admin bar is live-updated. This PR fixes the bugs mentioned in the linked Trac ticket, so that now:

    • The "Edit Profile" item is no longer overwritten.
    • The aria-label of the user menu is now updated with the new display name.
    • The username line now reacts to the change. For example, if the new display name is no longer the same as the username, the menu won't show the username line.

Testing

  1. Activate an admin color scheme that only colors .display-name in the CSS. The easiest way is to install the Admin Color Schemes plugin.
  2. Hover the avatar menu, and verify that the whole Howdy, {name} greeting has the same text color.
  3. Go to Users -> Profile, and change the "Display name publicly as" field. Don't save.
  4. Verify that the display name in the admin bar and in the dropdown is live-updated, and that "Edit Profile" stays the same.
  5. Select your username as the display name, and verify that the username line below the greeting disappears. Select another name, and verify that it appears again.
  6. Inspect the user menu (#wp-admin-bar-user-actions), and verify that its aria-label matches the selected display name.

Use of AI Tools

AI assistance: Yes
Tool(s): Claude Code
Model(s): Opus 5.5
Used for: Code generation. Verified and tested by me.


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
Copy Markdown

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.

@fushar
fushar marked this pull request as ready for review October 14, 2026 13:53
@github-actions

github-actions Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

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 fushar, tyxla.

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

Comment thread src/js/_enqueues/admin/user-profile.js Resolved
Comment thread src/wp-includes/admin-bar.php Resolved
Comment thread src/js/_enqueues/admin/user-profile.js Resolved
Comment thread src/js/_enqueues/admin/user-profile.js Resolved
Comment thread src/js/_enqueues/admin/user-profile.js Resolved
Comment thread src/js/_enqueues/admin/user-profile.js Resolved
Comment thread src/js/_enqueues/admin/user-profile.js Resolved
Adds the `display-name` class to the "Howdy" greeting in the user menu, the same way as the "Edit Profile" item, so that admin color schemes that only style `.display-name` color the whole greeting and not only the name.

Fixes the live preview of the display name on the profile screen, which overwrote the "Edit Profile" item, did not update the `aria-label` of the user menu, and did not show or hide the username line.

@fushar fushar left a comment

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Thanks for the feedback. I've pushed a change. Here's the proposed full diff between 7.1 and after this PR:

 <li id='wp-admin-bar-my-account' ...>
   <a ...>
-    Howdy, <span class="display-name">admin</span>
+    <span class="display-name user-display-name">admin</span>
     <img ...>
   </a>
   <div class="ab-sub-wrapper">
     <ul role='menu' ...>
       <li id='wp-admin-bar-user-info' ...>
         <a ...>
           <img ...>
-          <span class='display-name'>admin</span>
+          <span class='display-name howdy'>Howdy, <span class='user-display-name'>admin</span></span>
           <span class='display-name edit-profile'>Edit Profile</span>
         </a>
       </li>
       ...
     </ul>
   </div>
 </li>

It's now more predictable. Highlighting two points:

  • I added a new .user-display-name class that targets the actual display name value, which the JS (and future plugins) can also target.
  • I keep .howdy class for consistency with the existing .edit-profile. This will be useful for plugins that want to target the howdy line specifically.

I also tested this with multiple "Howdy removal" plugins (P.S.: I just learned that they are tons such plugins 😅). The removal effect no longer works (as the markup changed), but there's no breakage either. I'll note this in a dev note.

Comment thread src/js/_enqueues/admin/user-profile.js Resolved
Comment thread src/js/_enqueues/admin/user-profile.js Resolved
Comment thread src/js/_enqueues/admin/user-profile.js Resolved
Comment thread src/js/_enqueues/admin/user-profile.js Resolved
Comment thread src/js/_enqueues/admin/user-profile.js Resolved
Comment thread src/wp-includes/admin-bar.php Resolved
Comment thread src/js/_enqueues/admin/user-profile.js Resolved
Comment thread src/js/_enqueues/admin/user-profile.js Resolved
Comment thread src/wp-includes/admin-bar.php Resolved
Comment thread src/wp-includes/admin-bar.php Resolved
Comment thread src/wp-includes/admin-bar.php Resolved
Comment thread src/js/_enqueues/admin/user-profile.js Resolved
Comment thread src/js/_enqueues/admin/user-profile.js Resolved
@github-actions

Copy link
Copy Markdown

A commit was made that fixes the Trac ticket referenced in the description of this pull request.

SVN changeset: 64502
GitHub commit: 5fc0a06

This PR will be closed, but please confirm the accuracy of this and reopen if there is more work to be done.

@github-actions github-actions Bot closed this Oct 19, 2026
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.

2 participants