Improve the admin bar focus style#12179
Conversation
|
Hi there! 👋 Thank you for your contribution to WordPress! 💖 It looks like this is your first pull request to No one monitors this repository for new pull requests. Pull requests must be attached to a Trac ticket to be considered for inclusion in WordPress Core. To attach a pull request to a Trac ticket, please include the ticket's full URL in your pull request description. Pull requests are never merged on GitHub. The WordPress codebase continues to be managed through the SVN repository that this GitHub repository mirrors. Please feel free to open pull requests to work on any contribution you are making. More information about how GitHub pull requests can be used to contribute to WordPress can be found in the Core Handbook. Please include automated tests. Including tests in your pull request is one way to help your patch be considered faster. To learn about WordPress' test suites, visit the Automated Testing page in the handbook. If you have not had a chance, please review the Contribute with Code page in the WordPress Core Handbook. The Developer Hub also documents the various coding standards that are followed:
Thank you, |
|
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. |
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. |
| #wpadminbar ul li:last-child .ab-item { | ||
| box-shadow: none; | ||
| } | ||
|
|
There was a problem hiding this comment.
This should be double checked. I have no idea why the last item in a menu was supposed to not use a box-shadow. Had to remove it otherwise the new focus style wouldn't work.
There was a problem hiding this comment.
I did some exploring, but I couldn't see any good reason for it, either. I thought it could be a leftover from some older styles, but couldn't find evidence of that. It's old; been there since at least 3.3.
There was a problem hiding this comment.
I do not know of a reason to keep it either (otherwise, the specificity could be reduced).
r19328 added the box-shadow rule(s).
- At that time, admin-bar.dev.css only added a
box-shadowfor the flyout submenu containers and the shortlink input, neither of which would be anlielement or have the.ab-itemclass. - I did not find any mention of this
:last-childbox-shadowon the six tickets referenced in the commit message. Images below comment 29 on ticket 18197 show a shadow on the W logo, which would not be the last item in a list. The admin-bar-show-right-border-with-custom-menu.diff patch has a:last-childselector, but that relates to the search input. - r26072 removed
border-right: 0but keptbox-shadow: none.
joedolson
left a comment
There was a problem hiding this comment.
There are a couple of changes in here not strictly related to the focus styles (e.g., the fixed height of text in the profile menu), but IMO those are fine to include.
sabernhardt
left a comment
There was a problem hiding this comment.
I like this overall, but it still should have a few changes.
| background: none; | ||
| padding: 0; | ||
| height: 18px; | ||
| line-height: 1.38461538; |
There was a problem hiding this comment.
Changing the line-height is good.
However, the height gave some space between the username and "Edit Profile" (if the username does not match the display name). To preserve that design, the span elements could have a min-height of 18px.
If the separation is unimportant, at least the small line-height should be removed for narrower screens. The negative margin seems fine with "editor" as the username, but it is probably better to remove that for characters with descenders. (The screenshots below do not include a min-height.)
| outline-offset: -1px; | ||
| /* Only visible in Windows High Contrast mode */ | ||
| outline: 2px solid transparent; | ||
| box-shadow: inset 0 -4px 0 0 currentColor; |
There was a problem hiding this comment.
The currentColor has a conflict on narrower screens for core links with icons attached to .ab-item::before. Removing the old rule should fix it.
- r26134 added
#999for.ab-itemin the 'my-sites' and 'site-name' nodes on small screens. - r36587, one of the commits that edited the color value, questioned why the
colorrule was necessary. - The
colors.cssstylesheets use#wpadminbar.nojq .quicklinks .ab-top-menu > li > .ab-item:focus, so plugins such as "View Admin As" would display the correct color even though they have their icon on the::beforepseudo-element. - Yoast Duplicate Post defines
#999as the color, and that would need updating.
| /* Only visible in Windows High Contrast mode */ | ||
| outline: 2px solid transparent; | ||
| box-shadow: inset 0 -4px 0 0 currentColor; | ||
| transition: box-shadow .1s linear; |
There was a problem hiding this comment.
Core is not perfectly consistent about the leading zero, but it is in the coding standards.
| transition: box-shadow .1s linear; | |
| transition: box-shadow 0.1s linear; |
Trac ticket: https://core.trac.wordpress.org/ticket/65445
Use of AI Tools
None
This is a Proof Of Concept to improve the focus style on the admin bar.
See attached video recording to illustrate.
Comments on the Trac ticket.
Screen.Recording.2026-06-15.at.13.34.27.mov
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.