Toolbar: Fix missing focus style on the home icon in mobile layouts - #12780
Toolbar: Fix missing focus style on the home icon in mobile layouts#12780shamimmoeen wants to merge 2 commits into
Conversation
The home icon is drawn on `.ab-item::before` and has no nested `.ab-icon` span. In mobile layouts its resting colour is more specific than its focus colour, so focusing the link never changes the icon: resting #wpadminbar.mobile .quicklinks .ab-item:before (1,3,1) focus #wpadminbar li .ab-item:focus:before (1,2,2) Add a focus selector next to the existing `.hover` rule, at matching specificity (1,4,1). Both files are needed. `colors/_admin.scss` generates the admin colour schemes. `admin-bar.css` handles the two cases that load no colour scheme file at all: the Fresh scheme, and the toolbar on the front end of the site. See https://core.trac.wordpress.org/ticket/65765
|
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. |
Trac ticket: https://core.trac.wordpress.org/ticket/65765
The home icon is drawn on
.ab-item::beforeand has no nested.ab-iconspan. In mobile layouts its resting colour is more specific than its focus colour, so focusing the link never changes the icon:This adds a focus selector next to the existing
.hoverrule, at matching specificity (1,4,1).Both files are needed.
colors/_admin.scssgenerates the admin colour schemes.admin-bar.csshandles the two cases that load no colour scheme file at all: the Fresh scheme, and the toolbar on the front end of the site.Note
#wpadminbaronly gets themobileclass whenwp_is_mobile()returns true, so reproducing needs a device preset in DevTools or a real device — narrowing the browser window is not enough.Screenshots
The front-end pair also shows the mechanism:
site-nameandsite-editordraw their icons on.ab-item::beforeand gain a focus colour with the patch, whilecommentsuses a nested.ab-iconand was already working.Use of AI Tools
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.