Make WordPress Core

Opened 5 months ago

Closed 13 days ago

Last modified 12 days ago

#65445 closed defect (bug) (fixed)

Improve the focus state in the admin bar

Reported by: joedolson Owned by: joedolson
Priority: normal Milestone: 7.2
Component: Toolbar Version: 7.0
Severity: normal Keywords: has-test-info has-screenshots commit
Cc: Focuses: ui, accessibility, css

Description

The default focus state in the admin bar is very subtle. It's visually very similar to the focus state used for submenus in the side menu.

As indicated by #64859, this state makes the user experience somewhat confusing. In my opinion, this confusion is caused mostly because the focus state is different from other top level contexts, and doesn't clearly convey what is actually going on.

The focus state in the adminbar should be made stronger - either by using the same focus state used in the side menu (inverted colors in blue/white) or by using the same focus state used in the main content area (outlined).

Given the context, the inverted colors makes more sense.

Attachments (16)

65445-before.png​ (501.7 KB ) - added by khokansardar 5 months ago.
65445-after.png​ (502.3 KB ) - added by khokansardar 5 months ago.
65445 edit profile.png​ (35.8 KB ) - added by afercia 5 months ago.
65445-without-PR.png​ (55.3 KB ) - added by jns141191 4 months ago.
65445-with-PR.png​ (115.4 KB ) - added by jns141191 4 months ago.
before-apply-patch.png​ (685.5 KB ) - added by iamraju 4 months ago.
Before Apply Patch
after-apply-patch.png​ (741.9 KB ) - added by iamraju 4 months ago.
After Apply Patch
01 bugs.png​ (23.2 KB ) - added by afercia 4 months ago.
The additional bugs
02 fixed.png​ (84.7 KB ) - added by afercia 4 months ago.
After the fixes
1-admin-right-side.png​ (65.5 KB ) - added by Joen 2 months ago.
1 - focus user profile
2-admin-right-side-flyout-focus.png​ (83.7 KB ) - added by Joen 2 months ago.
2 - user profile opened
3-admin-right-side-flyout.png​ (83.7 KB ) - added by Joen 2 months ago.
3 - focus first tabbable inside
menu1.png​ (9.8 KB ) - added by muryam 4 weeks ago.
mnu3.png​ (8.9 KB ) - added by muryam 4 weeks ago.
mnu2.png​ (9.9 KB ) - added by muryam 4 weeks ago.
menu4.png​ (11.7 KB ) - added by muryam 4 weeks ago.

Change History (78)

This ticket was mentioned in ​Slack in #accessibility by joedolson. ​View the logs.


5 months ago

#2 @khokansardar
5 months ago

  • Keywords has-patch has-test-info added; needs-patch removed

Patch testing report

Patch / PR tested

Environment

WordPress: 7.1-alpha-62161-src
PHP: 8.2.18 (Docker)
MySQL: 8.0.36
OS: macOS 26.5.1
Browser: Chromium, desktop viewport (>782px)
Local wordpress-develop @ ​http://localhost:8889

Steps

  1. Built trunk (build:dev), logged into wp-admin, moved keyboard focus to a top-level admin bar item ("+ New"). Recorded the "before" state.
  2. Checked out PR #12143, rebuilt (build:dev), reloaded wp-admin.
  3. Focused top-level items in both the left group ("+ New", site name) and the right group ("Howdy, admin"). Recorded the "after" state.
  4. Verified scoping: idle (unfocused) state, submenu/dropdown child items, and the .mobile / .nojq selector branches.

Results

  • Before (trunk): pass — focused top item had background rgb(12,12,12) with only a faint text-colour shift to rgb(123,144,255); no outline, no inversion. Reproduces the "very subtle focus state" described in the ticket.
  • After (PR): pass — focused top-level item shows a solid inverted focus: background rgb(56,88,233) (scheme $menu-highlight-background) with white text rgb(255,255,255) and white icon glyphs. Clearly distinct and matches the side-menu inverted style requested in the ticket.
  • Right-secondary group: pass — "Howdy, admin" / search items also receive the inverted focus, keeping both ends of the bar consistent.
  • Scheme-aware: pass — SCSS uses $menu-highlight-background/$menu-highlight-text/$menu-highlight-icon, so the focus colour follows the active admin colour scheme rather than being hard-coded.
  • Idle state: pass — unfocused top items remain transparent; no inversion bleeds into the resting state.
  • Submenu items: pass — dropdown child links do not match the new rules; the inversion is scoped to direct top-level .ab-item only, so submenu focus styling is untouched.
  • Mobile/no-JS branches: pass — :not(.mobile) correctly excludes the touch (mobile-with-JS) case, while the .nojq branch keeps a visible focus when JavaScript is unavailable. Behaviour is sound progressive enhancement.

Conclusion
PR #12143 replaces the near-invisible default focus state on top-level admin bar items with a strong inverted blue/white focus (background + text + icon), matching the side-menu treatment the ticket recommends. The change is minimal and CSS-only — _admin.scss (scheme variables) and the compiled admin-bar.css (fresh-scheme fallback) — scoped strictly to top-level items, scheme-aware, and correctly excludes the mobile-with-JS case while preserving a visible focus in the no-JS (.nojq) path. Purely additive CSS with no markup, signature, hook, or default-behaviour changes, so no backward-compatibility concerns. Recommend commit.https://core.trac.wordpress.org/attachment/ticket/65445/65445-before.pnghttps://core.trac.wordpress.org/attachment/ticket/65445/65445-after.png

This ticket was mentioned in ​PR #12179 on ​WordPress/wordpress-develop by ​@afercia.


5 months ago
#3

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.

​https://github.com/user-attachments/assets/7612be1a-2fbe-4bfc-a0d4-7f7190a67652

#4 @afercia
5 months ago

While ​https://github.com/WordPress/wordpress-develop/pull/12143 introduces a new style by using an inversion of colors, ​https://github.com/WordPress/wordpress-develop/pull/12179 aims to reuse the same style already in use for the admin menu: a border shape (actually a box-shadow).

See the video recording on the PR.

To test:

Install a few plugins that add menus to the admin bar, for example:

  • Query Monitor
  • View Admin As
  • Yoast SEO

Please test with more plugins, not just limited to the ones mentioned above.

Navigate the admin bar by using the keyboard.
Observe the focus style is the same one used for the admin menu:

  • Horizontal box-shadow 'bar' for the top-level items.
  • Vertical box-shadow 'bar' for the sub-menu items.
  • The CSS uses currentColor so that it uses any color set in the current admin color scheme.

Test also on the front end.

To me, both PRs highlight one fundamental issue: the admin bar should be taller.
On large screen, the admin bar is only 32 pixels. It's way too small on modern displays. It's 2026 and the admin bar shows its age.
On small screens (mobile) the admin bar height is 46 pixels.

If no objections from a design perspective, I'd like to propose for WordPress 7.1 to make the admin bar always have a 46 pixels height regardless of the screen size. That would:

  • Improve usability, accessibility and provide a better user experience for everyone.
  • It would allow to simplify the CSS as the height would always be 46 pixels.

However, although it would be a pretty trivial change, it should be extensively tested and implemented early in the release cycle to allow for a call for testing by:

  • Plugins that add their own menus in the admin bar.
  • Themes that use fixed headers and such and may have in place CSS that takes into account the 32 pixels height.

This ticket was mentioned in ​Slack in #accessibility by joedolson. ​View the logs.


5 months ago

​@joedolson commented on ​PR #12143:


5 months ago
#6

Following discussion, @afercia and I are of the opinion that it would be better to go with a change that doesn't invert colors. This is mostly because inverting colors can cause problems for extenders who are assuming that the background is always dark/doesn't change. While the style is fine, we'd like to avoid that extra friction.

#7 @afercia
5 months ago

Thinking that the best approach would be a mix of the two PRs. For consistency with the admin menu:

  • The top level items should get the color inversion from the first PR and the border shape from the second PR.
  • The sub-items should get the border shape.

#8 @afercia
5 months ago

It is worth noting that the admin scheme color changes in WordPress 7.0 introduced a small regression in the edit profile menu, where the link '{username} Edit Profile' doesn't have any focus style.

In 6.9 the link text used to change to blue.

That is because the new white for the link text has been applied to the span within the link and while it provides a style for hover, it doesn't for focus:

​https://github.com/WordPress/wordpress-develop/blob/2303172b509f4dfd7e068a044d0aae88a1786f56/src/wp-admin/css/colors/_admin.scss#L527-L533

See screenshot.

This ticket was mentioned in ​Slack in #accessibility by joedolson. ​View the logs.


4 months ago

This ticket was mentioned in ​Slack in #core-test by huzaifaalmesbah. ​View the logs.


4 months ago

#11 @afercia
4 months ago

  • Owner set to afercia
  • Status new → assigned

#12 @jns141191
4 months ago

Test Report

Patch tested: ​https://github.com/WordPress/wordpress-develop/pull/12143

Environment

  • WordPress: 7.1-beta3
  • PHP: 8.2.29
  • Server: nginx/1.26.1
  • Theme: Twenty Twenty-Five 1.5
  • Plugins:
  • Gutenberg 23.6.0
  • Query Monitor 4.0.7
  • Test Reports 1.3.0
  • WordPress Beta Tester 4.0.0

Steps taken

  1. Installed and built WordPress trunk (7.1-beta3).
  2. Verified the current behavior without applying the PR.
  3. Logged into the WordPress admin dashboard.
  4. Used the Tab key to navigate through the top-level Admin Bar items (for example: WordPress logo, Site Name, + New, and Howdy, Admin).
  5. Observed the keyboard focus styling before applying the patch.
  6. Applied PR #12143 and rebuilt the development build.
  7. Repeated the same keyboard navigation through the Admin Bar items.
  8. Compared the focus state before and after applying the PR.

Result: ❌ Patch needs further work.

Expected result

According to the ticket discussion, focused top-level Admin Bar items should receive a clear inverted focus state that matches the active Administration Color Scheme (highlight background with contrasting text/icons), making keyboard focus clearly visible and improving accessibility.

Actual result

After testing the PR, I could observe a visible keyboard focus indicator (blue focus line) on the top-level Admin Bar items compared to the current trunk behavior, where the focus state remains very subtle.

However, the expected inverted styling (highlighted background with contrasting white text/icons) described in the ticket discussion is not fully present in the current implementation. Based on the ongoing discussion, the proposed solution is still under development and additional work is required before the ticket can be considered complete.

Additional Notes

  • The issue is reproducible on the current trunk.
  • The PR improves keyboard focus visibility compared to trunk.
  • The implementation does not yet appear to match the intended design discussed in the ticket.
  • As noted in the ticket discussion, further work (including combining the proposed changes and resolving regressions) is still pending.

Screenshots results

  • Before:
  • After:

Support Content

Last edited 4 months ago by jns141191 (previous) (diff)

#13 @afercia
4 months ago

@sabernhardt thanks for the feedback on the linked PR. Would you like to take it over? You're much more detail-oriented than I am in this kind of things.

We should also make a few decisions:

  • Do we want to pair the focus styling with the one for the admin menu? As in: adding the inversion of colors on the top level items and making it compatible with the admin color schemes.
  • Do we want to pair the focus style with the hover, like in the admin menu?

I tried the above and it would make the change more complex and prone to edge case glitches. I'd tend to think that's more a design decision. For now, I would go with just a basic focus style.

This ticket was mentioned in ​Slack in #accessibility by joedolson. ​View the logs.


4 months ago

#15 @afercia
4 months ago

the proposed solution is still under development and additional work is required before the ticket can be considered complete.

This was discussed during latest accessibility team bug-scrub on Slack (see link above) and agreed to postpone further changes. The box-shadow at the bottom is a minimal step, still it's a ignificant improvement.

The most important thing is testing this change with plugins that add their own stuff to the admin bar, for example Query Monitor, View Admin As, Yoast SEO, and more. Having this change in the 7.1 Beta / RC would help having a larger audience of testers.

This ticket was mentioned in ​Slack in #core-test by noruzzaman. ​View the logs.


4 months ago

#17 @iamraju
4 months ago

Patch Test Report

Patch tested: ​https://github.com/WordPress/wordpress-develop/pull/12179

Environment

  • WordPress: 7.1-beta4
  • Subdirectory: No
  • PHP: 8.3.32
  • Server: PHP.wasm
  • Database: WP_MySQL_On_SQLite (Server: 8.0.38 / Client: 3.51.0)
  • Browser: Chrome 150.0.0.0
  • OS: macOS
  • Theme: Twenty Twenty-Five 1.5
  • MU Plugins: None activated
  • Plugins:
    • Test Reports 1.3.0

Steps taken

  1. Opened the WordPress Playground preview for PR #12179.
  2. Navigated to the WordPress admin area and used the Tab key to move keyboard focus through the admin bar items.
  3. Compared the keyboard focus styling before and after applying the patch.
  4. Verified that the focused admin bar item now displays inverted colors (blue background with white text) along with an underline, making the current keyboard focus much more visible.

Result: ✅ Patch is solving the problem.

Expected result

  • The focused admin bar item should have a clear and prominent focus state during keyboard navigation.
  • The focus styling should use inverted colors and an underline to improve visibility and provide a consistent user experience.

Actual result

  • The focused admin bar item now displays inverted colors (blue background with white text) together with an underline, making the current keyboard focus easy to identify.
  • The updated styling improves keyboard accessibility and matches the expected behavior.

Additional Notes

  • The new focus styling is significantly more noticeable than the previous implementation.
  • The combination of inverted colors and an underline provides a clearer visual indication of keyboard focus in the admin bar.
  • No regressions or unexpected behavior were observed during testing.

Screenshots/Screencast with results

  • Screenshot or screencast before applying the patch.
  • Screenshot or screencast after applying the patch.
Last edited 4 months ago by iamraju (previous) (diff)

#18 @afercia
4 months ago

The focused admin bar item now displays inverted colors (blue background with white text) together with an underline, making the current keyboard focus easy to identify.

@iamraju this is not accurate, as can be seen also in the screenshots you posted. There are two PRs linked to this ticket and ​https://github.com/WordPress/wordpress-develop/pull/12179 adds the outline but it does not use any inversion of colors.

While testing reports are very appreciated, I'd kindly suggest to:

  • Please try to post accurate reports. I suggest to not 100% trust automatic tools, always verify the automatically generated reports.
  • Please post concise information. Committers have to take care of many tickets and patches. Parsing all that redundant information is extremely time consuming.

I see you posted and then deleted another report with a few attachments. It was related to 2. After appling the patch the header element hover Underline not showing.
Please note that even if a comment on a ticket gets deleted, all users subscribed to this ticket receive email notifications so I had to go through all that deleted report before realizing it was then deleted.
Again, test reports are very appreciated but please try to be accurate.

Last edited 4 months ago by afercia (previous) (diff)

#19 @afercia
4 months ago

Latest commits on the PR fix two more bugs:

  1. The site name item on mobile didn't change color on focus.
  2. The menu toggle item size was inconsistent, leaving a 1 pixel gap around it.

See screenshots.

This needs to be tested on desktop and mobile, with both the default site icon and a custom site icon. See second screenshot.

@afercia
4 months ago

The additional bugs

@afercia
4 months ago

After the fixes

#20 @joedolson
4 months ago

Noting that the change includes the fix to #65765, and that ticket should be closed and the participants credited when this is committed.

#21 @afercia
3 months ago

An important note for testing:

When using your browser devtools to emulate the responsive view, your browser may send a user-agent header that identifies your device as a 'mobile' device.

In that case, the admin bar gets an additional CSS class ​mobile that is added on the PHP side. That means it's not added and removed 'on the fly' as you change your browser's viewport size. It stays there until you close the devtools and refresh the page.

Introduced 15 years ago in [19368] where it used the global $is_iphone and then changed 14 years ago in [20417] to use wp_is_mobile().

For this reason, testing the responsive view may be a little confusing, as it's a mix of rules based on media queries and the presence of the mobile class.

In fact, the mobile class may still be there even when the responsive media queries don't kick in because the current viewport is large enough.

Suggest:

  • To test responsiveness, do not use the devtools. Keep them closed and just resize your browser's window.
  • To test the 'real' mobile view, use the devtools.

Note that the hover style is, in a way, broken when the mobile class stays there. Actually, looking at the current implementation, the intended behavior appears to be that on the 'real' mobile view the hover should not change colors. That intent is understandable as on mobile devices there is no hover state.

When the mobile class stays there even with a large viewport, the hover style is slightly broken also on trunk. I'm not going to fix that in this ticket. All of this would benefit from some significant simplification. I'm not sure there is still a reason to use wp_is_mobile(). It would be best to get rid of the mobile class and only use media queries. Material for a new ticket.

​@afercia commented on ​PR #12179:


3 months ago
#22

On more note:

In the 'Sites' sub-menu on multisite, in the mobile view the alignment of the right triangle arrows icons is off.
More importantly, the sub-menus 'Network Admin' and the ones for the sites ('WordPress Develop') in the screenshot, are not opeerable with a keyboard.
I think there's already a ticket for this. If not, we should create one.

https://github.com/user-attachments/assets/95bc728a-ca7a-4d67-bf59-d1279d7308ef

​@ugyensupport commented on ​PR #12179:


3 months ago
#23

## Test Report

Patch tested: this PR (65445-admin-bar-focus) · Trac: #65445
Result: ✅ Patch is solving the problem — the focus indicator, last-child fix, keyboard focus, and mobile toggle all behave as intended, with no regressions observed.

### Environment

WordPress 7.0.2
PHP 8.5.8
Server PHP built-in server (WP-CLI wp server)
Database SQLite
Browser Chromium (Playwright), headless
Admin color scheme Modern (theme color #7b90ff)
OS macOS

### What I tested & observed
Focus indicator — verified via computed styles and screenshots, with an admin color scheme active so currentColor is exercised:

Focus target Before patch After patch
Top-level item (incl. last-child “My Account”) box-shadow: none — color change only box-shadow: inset 0 -4px 0 0 currentColor → visible bottom border
Submenu item (“Log Out”) box-shadow: none box-shadow: inset 4px 0 0 0 currentColor → visible left border
Real keyboard Tab into the bar no indicator indicator renders on genuine :focus
  • The previously-suppressed last-child item now shows the indicator — confirming the removal of #wpadminbar ul li:last-child .ab-item { box-shadow: none } does its job.
  • currentColor makes the indicator adopt the item’s focus color per scheme (the stated benefit for custom admin-bar icons that don’t recolor on focus).

Mobile menu-toggle (admin-menu.css), at a responsive width (600px):

  • Computes to height: 46px, box-sizing: border-box, margin-left: 0, border-width: 0 (was 44px / margin-left: -1px / 1px transparent border). Renders cleanly, no shift.

No console errors attributable to the patch.

### Notes on method

  • Tested against the 7.0.2 release build rather than trunk, so a couple of hunks didn’t apply line-for-line; I applied the PR’s *resulting* rules and confirmed the outcome via computed styles rather than a raw git apply. The new ID-level #wpadminbar a:focus correctly wins over both the older box-shadow: none group and the color scheme’s broader a:focus ring (specificity, not source order).
  • The _admin.scss change is a color-only, per-scheme refinement — reviewed in the diff, not separately recompiled in this environment.
  • Minor gotcha for anyone else testing: the new transition: box-shadow 0.1s linear means reading computed styles in the same tick as .focus() catches a mid-transition value; sample after it settles to see the final currentColor border.

Before/after screenshots captured for each case — happy to attach if useful.

This ticket was mentioned in ​Slack in #accessibility by joedolson. ​View the logs.


3 months ago

#25 @joedolson
3 months ago

  • Keywords commit added

#26 @afercia
3 months ago

  • Resolution → fixed
  • Status assigned → closed

In 63009:

Toolbar: Improve the focus style indication.

  • Updates the toolbar items styling by adding a more prominent focus indicator.
  • Adjusts label and icon coloring selectors (including mobile-specific focus states).
  • Refines the 'Howdy menu' dropdown layout and focus styles.
  • Tweaks the responsive menu toggle item sizing.

Props afercia, joedolson, sabernhardt, khokansardar, jns141191, iamraju, sukhendu2002, shamimmoeen, ugyensupport.
Fixes #65445.
Fixes #65765.

#27 @wildworks
3 months ago

I intend to display the indicator not only when focused, but also when hovered. See ​https://github.com/WordPress/wordpress-develop/pull/12969 for more details.

#28 @joedolson
3 months ago

In 63306:

Toolbar: Revert focus and hover style changes.

Reverts the focus and hover style changes in the admin toolbar. Reverts [63190], [63009], and [63188], restoring the appearance in WordPress 7.0.

Props fushar, wildworks, ravichudasama01, afercia, joen, keoshi, cbusquets1989, annezazu.
Fixes #65849. See #65445.

#29 @joedolson
3 months ago

  • Milestone 7.1 → 7.2
  • Resolution fixed
  • Status closed → reopened

These changes were reverted for 7.1, so I'm reopening the ticket.

The problems with the hover/focus style were not reconcilable with design, so we're going to explore alternate designs for 7.2.

Two possible proposals were made in #65849: to implement the same design used in the admin sidebar, inverting colors or to change both the admin sidebar and the adminbar to use the blue outline focus state that's used for buttons, links, and inputs within the admin.

#30 @wildworks
3 months ago

In 63318:

Toolbar: Revert focus and hover style changes.

Reverts the focus and hover style changes in the admin toolbar. Reverts [63190], [63009], and [63188], restoring the appearance in WordPress 7.0.

Reviewed by wildworks.
Merges [63306] to the 7.1 branch.

Props fushar, wildworks, ravichudasama01, afercia, joen, keoshi, cbusquets1989, annezazu.
Fixes #65849. See #65445.

#31 @joedolson
2 months ago

  • Keywords needs-patch needs-design added; has-patch commit removed

#32 @afercia
2 months ago

This change has been reverted one month ago. No new design feedback has been provided yet. As such, this much needed accessibility fix is blocked by lack of ownership. In the spirit of improving the contribution process and collaboration between teams, I would like to propose to discuss this point soon in the next accessibility team bug scrub.

This ticket was mentioned in ​Slack in #accessibility by afercia. ​View the logs.


2 months ago

@Joen
2 months ago

1 - focus user profile

@Joen
2 months ago

3 - focus first tabbable inside

#34 @Joen
2 months ago

Shared 3 mockups, meant to be seen in succession, one after another, showing simply a focus-ring as it navigates the tree.

Note that the mockup includes a larger "Edit user profile" button. That does not have to be part of the effort here, but it is nevertheless shared in response to a converation with @joedolson around how the findability of the user profile is currently in a poor state.

​@nicoblandel commented on ​PR #12179:


2 months ago
#35

I really like this improvement, good job, this is working perfectly!

#36 @joedolson
2 months ago

Moving to a standard ring focus style is definitely what I would prefer for this; it should greatly increase consistency.

That said, the focus ring used in the mock up looks like the Gutenberg focus ring, and not the core focus ring. That's already an open issue in #65878, and should be resolved first.

Since the adminbar and the admin menu currently have focus states that are different from the rest of core, they just stand out as "different" - but if the adminbar gets a matched focus state, then that difference will be much more noticeable.

This ticket was mentioned in ​Slack in #accessibility by annezazu. ​View the logs.


2 months ago

#38 @afercia
8 weeks ago

  • Keywords needs-refresh added; needs-patch needs-design removed

I see the design feedback provided in comment:34 is limited to the 'Howdy' (user profile) menu. This ticket is about the focus style of the entire admin bar. I'm assuming the outline should be applied to all the items in the admin bar.

This ticket was mentioned in ​PR #13622 on ​WordPress/wordpress-develop by ​@afercia.


8 weeks ago
#39

  • Keywords has-patch added; needs-refresh removed

Trac ticket: https://core.trac.wordpress.org/ticket/65445#comment:38

Tries a focus ring to improve the admin bar focus style.

Use of AI Tools

None

#40 @afercia
8 weeks ago

  • Keywords has-patch removed

​https://github.com/WordPress/wordpress-develop/pull/13622 tries the new focus ring.

For now, the color for the ring is --wp-admin-theme-color which varies depending on the active admin color scheme. The design doesn't tell anything about how the ring color should adapt to the admin color scheme in use. It can't be a fixed blue. As such, --wp-admin-theme-color is the first thing we should try but I'm not sure it produces a sufficient color contrast ratio.

I suggest to test the PR in the User profile admin page wp-admin/profile.php so that it's quick to test with all the admin color schemes.

You can also test it in Playground: ​https://playground.wordpress.net/wordpress.html?pr=13622

Last edited 8 weeks ago by afercia (previous) (diff)

​@fushar commented on ​PR #13622:


7 weeks ago
#41

I tested the PR. It looks better than the previous iteration 🙂

I noticed two possible regressions when using mouse to hover on the nodes:

  1. The text color uses wrong blue color,
  2. The background becomes rounded:

https://github.com/user-attachments/assets/0f5e7b6f-f90a-4820-87af-a4309376eb46

For (2), I believe we can keep the background as rectangle while the focus ring is rounded? It seems it's what's proposed in the design mockup above:

https://github.com/user-attachments/assets/4f2c5486-77fd-441d-84e1-b56b40b97c58

Also, I noticed that when clicking the nodes, we show the focus ring momentarily while the page loads. We should confirm whether that's the intended behavior.

​@afercia commented on ​PR #13622:


7 weeks ago
#42

The background becomes rounded:

This PR is experimental so far. Btw, I think the background change should be just removed.
Making the outline rounded and the background squared would make the implementation unnecessarily complicated as it would require two elements to be styled (likely one as a pseudo element).

This ticket was mentioned in ​Slack in #accessibility by afercia. ​View the logs.


6 weeks ago

​@joedolson commented on ​PR #13622:


5 weeks ago
#44

I agree with removing the background; I don't think that's necessary or helpful.

And in my opinion, getting the focus outline on click is correct; but that's a larger cross-project question that I don't think needs to be resolved in this ticket.

​@afercia commented on ​PR #13622:


5 weeks ago
#45

Latest commit removes the background color change on both focus and hover. Let me know if it is preferable to keep it on hover but I'd lean towards simplicity.

the combination of the blue on the dark background is too hard to see in my opinion, despite not failing contrast standards.

While I have no problems with the _admin menu_ focus style (because the shape is ticker), I struggle to see the focus stile in the admin bar. I _can_ see it but it could be better. This is a case where making the outline thinner on high DPI screens (1.5px) is clearly not a good user experience. There is a separate trac ticket to make it 2 pixels and I'd strongly recommend it.

Assuming I picked up the correct color, seems to me #3858e9 on #1e1e1e produces ​a Luminosity Contrast Ratio of 2.97:1, which is technically insufficient.

getting the focus outline on click is correct

I agree. We _could_ consider to use focus-visible but than I'd requiire to actively style the :active state everywhere. To me, it is fundamental that low vision users get a confirmation they are clicking the right spot.

This ticket was mentioned in ​Slack in #accessibility by joedolson. ​View the logs.


5 weeks ago

​@afercia commented on ​PR #13622:


5 weeks ago
#47

A better option I'd recommend for the focus outline color is using the same color used for the menu item _text_.
This way, the outline has a better color contrast ratio with all the admin color schemes.

modern (default): #7b90ff
fresh:            #72aee6
light:            #007cba
all the others:   #fff (white) 

For the default (modern) color scheme, ​the Luminosity Contrast Ratio is 5.78:1.

A few example screenshots:

https://github.com/user-attachments/assets/e89040ee-3110-40c5-8155-7cd101fb670a

#48 @afercia
5 weeks ago

  • Keywords has-screenshots commit added

With the latest change on ​PR 13622 in my opinion this is ready for a final review and commit.

​@afercia commented on ​PR #13622:


5 weeks ago
#49

A note that this PR includes other fixes that were originally made, reviewed, and committed on the other PR ​https://github.com/WordPress/wordpress-develop/pull/12179 (which was then reverted).

These changes are related to bugfixes for the alignments, sizes, etc. of the admin bar menu items. For more details, please see the conversation on ​https://github.com/WordPress/wordpress-develop/pull/12179.

#50 @joedolson
5 weeks ago

  • Owner changed from afercia to joedolson
  • Status reopened → accepted

#51 @muryam
4 weeks ago

Patch testing report

Patch / PR tested: ​https://github.com/WordPress/wordpress-develop/pull/13622 — reuse the admin-menu focus style (a box-shadow "bar").
Also compared against ​PR #12143 (inverted blue/white style).

Environment

Steps

  1. Opened the PR at its latest commit (13622) in Playground via playground.wordpress.net/wordpress.html and logged into wp-admin.
  2. Installed the plugins above so the admin bar has extra top-level menus.
  3. Using the keyboard only (Tab / arrow keys), moved focus across the admin bar — top-level items and their submenus.
  4. Repeated on the front end (admin bar visible while logged in).
  5. Checked every admin colour scheme (Users → Profile): Default, Light, Modern, Blue, Coffee, Ectoplasm, Midnight, Ocean, Sunrise.

Results

  • Top-level items: focus shows the horizontal box-shadow "bar", matching the admin menu. ✅
  • Submenu items: focus shows the vertical box-shadow "bar". ✅
  • currentColor is honoured — the focus adapts correctly in all nine admin colour schemes (Default, Light, Modern, Blue, Coffee, Ectoplasm, Midnight, Ocean, Sunrise). ✅
  • Front end: same focus style appears. ✅
  • No-JS (.nojq): a visible focus is preserved. ✅
  • Mobile-with-JS case correctly excluded. ✅
  • Plugin menus (Query Monitor / View Admin As / Yoast): focus is consistent across all. ✅





Conclusion

Tested the latest commit (13622) in Playground across all admin colour schemes. The box-shadow approach gives a clear, scheme-aware focus consistent with the admin menu, with a sound no-JS fallback — aligns with the mix proposed in comment #7. Looks good to me.

Last edited 4 weeks ago by muryam (previous) (diff)

​@rollybueno commented on ​PR #13622:


3 weeks ago
#52

Tested locally on the Dashboard using the default color scheme. Focusing the site name displays a 2px #7b90ff outline with a 4px inset and 5px border radius, without a background. Hovering only changes the text color. The “Visit Site” submenu link also displays the same focus outline.

Approving :+1:

#53 @rollybueno
3 weeks ago

Test Report

Patch tested: ​https://github.com/WordPress/wordpress-develop/pull/13622

Environment

  • WordPress: 7.2-alpha-63166-src
  • Subdirectory: No
  • PHP: 8.2.29
  • Server: nginx/1.29.4
  • Database: mysqli (Server: 8.4.8 / Client: mysqlnd 8.2.29)
  • Browser: Firefox 158.0
  • OS: Ubuntu
  • Theme: Twenty Twenty-Five 1.5
  • Plugins:
    • Test Reports 1.3.0

Steps taken

  1. Check out PR 13622 at f96dd23b3a and open ​http://localhost:8889/wp-admin/ while logged in as admin. The active scheme is Default (registered as modern).
  2. Hard-refresh so wp-includes/css/admin-bar.css is not served from cache. The first load still had an older admin-bar.css under the same ?ver= query.
  3. Focus the "WordPress Develop" toolbar item. Confirm the ring, text color, and background.
  4. Hover that same item. Confirm text color and that no background fill appears.
  5. Open the site-name menu and focus "Visit Site".

✅ Patch is solving the problem

Expected result

  • A focused admin bar link shows a visible inset rounded ring.
  • On the Default scheme, that ring and the focused label use #7b90ff.
  • Hover changes the label color and does not add a background fill.
  • A focused submenu link gets the same ring.

Additional Notes

  • Computed style on the focused site-name link: outline rgb(123, 144, 255) solid 2px, outline-offset -4px, border-radius 5px, background transparent. 2px comes from --wp-admin-border-width-focus. #7b90ff is Default's menu focus text color.
  • Hover on that item: color #7b90ff, background transparent, no outline.
  • "Visit Site" in the open submenu used the same ring and text color.
  • Not tested: Light, Midnight, and the other schemes; the front end; a viewport under 782px; the toolbar search field. The search input still has outline: none in admin-bar.css, so it will not get this ring.

Screenshots

https://i.imgur.com/OfaL6Rz.jpeg
https://i.imgur.com/Y2wwjTo.jpeg

Support Content

​@joedolson commented on ​PR #13622:


3 weeks ago
#54

@jasmussen I think this is ready to commit; it uses the design you produced for the ticket, though using colors available in core. This focus state more closely matches the experience in the site editor, and fixes an existing accessibility issue with colors below contrast guidelines in the adminbar. Would appreciate your review!

​@Joen commented on ​PR #13622:


3 weeks ago
#55

Thank you, at a glance this looks good to me, fixes an issue, and moves us forward. If you need more technical review input, I'd recommend @ciampo for a glance.

​@joedolson commented on ​PR #13622:


2 weeks ago
#56

Thank you!

​@joedolson commented on ​PR #13622:


13 days ago
#57

I think it's gotten enough eyes; if there is anything additional to resolve, it can be caught during the rest of the cycle, and I don't think should block this. Thanks!

#58 @joedolson
13 days ago

  • Resolution → fixed
  • Status accepted → closed

In 65208:

Accessibility: Improve focus state and contrast in admin bar.

Change the admin bar focus state to use a focus ring, similar to the majority of other focus states throughout the admin. Previous focus state was only a color change, and set a color contrast of 2.97:1 on the default theme, below WCAG requirements.

Also fix miscellaneous alignment errors in the admin bar that were made more obvious by shifting to a focus outline.

Props joedolson, khokansardar, afercia, jns141191, iamraju, Joen, muryam, sukhendu2002, sabernhardt, ugyensupport, mciampini, fushar, rollybueno, shamimmoeen, wildworks, nicoblandel.
Fixes #65445.

​@fushar commented on ​PR #13622:


13 days ago
#59

Hi all 🙂 is this PR supposed to hide the hover background on admin bar items? I find it unexpected:

Before After
https://github.com/user-attachments/assets/c4ea7151-12e5-4a98-a434-426f737f7ced https://github.com/user-attachments/assets/6562bf05-51c1-4ec5-9f9f-23cf9ed979fc

​@fushar commented on ​PR #13622:


12 days ago
#60

Sorry, I should have read the PR discussion more carefully. The above does seem to be the intended outcome of this PR, maybe it's just me that's just very accustomed to the old behavior. 😬

​@fushar commented on ​PR #13622:


12 days ago
#61

I believe caused regression on certain color schemes. See this new ticket 🙂 https://core.trac.wordpress.org/ticket/66463

​@Joen commented on ​PR #13622:


12 days ago
#62

Let's not let that take down the whole improvement. A slight tweak should be possible. The radius exists to round the inset focus outline, so we can't remove it from the a element, but it should be possible to paint the hover background on the li instead:

In src/wp-includes/css/admin-bar.css:

#wpadminbar:not(.mobile) .ab-top-menu > li > .ab-item:focus,
 #wpadminbar.nojq .quicklinks .ab-top-menu > li > .ab-item:focus,
 #wpadminbar:not(.mobile) .ab-top-menu > li:hover > .ab-item,
 #wpadminbar .ab-top-menu > li.hover > .ab-item {
        color: #72aee6;
 }
+
+#wpadminbar:not(.mobile) .ab-top-menu > li:hover,
+#wpadminbar .ab-top-menu > li.hover {
+       background: #2c3338;
+}

And the same in src/wp-admin/css/colors/_admin.scss, so the other colour schemes keep up:

#wpadminbar:not(.mobile) .ab-top-menu > li:hover > .ab-item,
 #wpadminbar:not(.mobile) .ab-top-menu > li > .ab-item:focus,
 #wpadminbar.nojq .quicklinks .ab-top-menu > li > .ab-item:focus,
 #wpadminbar.nojs .ab-top-menu > li.menupop:hover > .ab-item,
 #wpadminbar .ab-top-menu > li.menupop.hover > .ab-item {
        color: variables.$menu-submenu-focus-text;
 }
+
+#wpadminbar:not(.mobile) .ab-top-menu > li:hover,
+#wpadminbar.nojs .ab-top-menu > li.menupop:hover,
+#wpadminbar .ab-top-menu > li.menupop.hover {
+       background: variables.$menu-submenu-background;
+}

The .nojq focus fill relied on :focus landing on the filled element. Here we can use :has(), in both files:

#wpadminbar.nojq .quicklinks .ab-top-menu > li:has(> .ab-item:focus) {
        background: #2c3338;
}
#wpadminbar.nojq .quicklinks .ab-top-menu > li:has(> .ab-item:focus) {
	background: variables.$menu-submenu-background;
}
Note: See TracTickets for help on using tickets.