Repository navigation
Conversation
Test using WordPress PlaygroundThe 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
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
db9a951 to
cc6f785
Compare
|
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. |
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.
98c7960 to
07517af
Compare
fushar
left a comment
There was a problem hiding this comment.
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-nameclass that targets the actual display name value, which the JS (and future plugins) can also target. - I keep
.howdyclass 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.
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-namein their CSS, so the display name gets the scheme's color but the "Howdy, " text doesn't. This PR adds thedisplay-nameclass to the greeting wrapper (<span class="display-name howdy">).Edit Profilelink for the same reason (see https://core.trac.wordpress.org/changeset/57765).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:
aria-labelof the user menu is now updated with the new display name.Testing
.display-namein the CSS. The easiest way is to install theAdmin Color Schemesplugin.Howdy, {name}greeting has the same text color.#wp-admin-bar-user-actions), and verify that itsaria-labelmatches 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.