Skip to content

Fix: Toolbar: live-preview of unsaved display name change is not accurate - #13881

Open
hbhalodia wants to merge 2 commits into
WordPress:trunkfrom
hbhalodia:fix/issue-66222
Open

hbhalodia wants to merge 2 commits into
WordPress:trunkfrom
hbhalodia:fix/issue-66222

Conversation

@hbhalodia

@hbhalodia hbhalodia commented Oct 1, 2026 •

Copy link
Copy Markdown

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

What

Fixes the toolbar account menu not updating correctly when you change the display name on wp-admin/profile.php, before saving.

Why

The live preview used one broad .display-name selector, which caused three bugs:

  1. "Edit Profile" in the dropdown was replaced with the display name.
  2. The submenu's aria-label still showed the old name.
  3. The username line didn't show or hide when the display name changed.

How

  • Target the "Howdy" greeting and the dropdown name separately, skipping .edit-profile.
  • Update the aria-label on #wp-admin-bar-user-actions using the same translatable Howdy, %s string.
  • Show the username line only when it differs from the display name, as the PHP output does.

Testing

  1. Log in as a user whose display name matches their username (e.g. admin).
  2. Go to Users → Profile, enter a First Name, and select it in Display name publicly as. Don't save.
  3. Hover over the account menu in the toolbar and check that:
    • "Edit Profile" is still shown.
    • The username appears below the new display name.
    • ul#wp-admin-bar-user-actions has aria-label="Howdy, <new name>".
  4. Switch the display name back to the username. The username line should go away.
  5. Edit another user's profile (user-edit.php). The toolbar should not change.

Screencast

Screen.Recording.2026-10-01.at.11.41.15.AM.mov

Use of AI Tools

  • Claude Code, Opus 5.5
  • Used for PR description, reproduction steps, and implementation.
  • It was reviwed 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

github-actions Bot commented Oct 1, 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 hbhalodia.

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

@github-actions

github-actions Bot commented Oct 1, 2026

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.

@hbhalodia
hbhalodia requested review from afercia and fushar October 5, 2026 14:28
@hbhalodia hbhalodia self-assigned this Oct 5, 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.

1 participant