Toolbar: Prevent false positive on automated contrast testing.

The non-focused state of the `.screen-reader-shortcut` element in the admin bar fails contrast tests. This has no real-world consequences, but raises false positives in some automated testing tools. This fix is largely so people using automated testing will not raise false positives.

Props sabernhardt, afercia, robinwpdeveloper, re_enter_rupok.
Fixes #56789.

git-svn-id: https://develop.svn.wordpress.org/trunk@55307 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Joe Dolson 2023-02-11 17:37:30 +00:00
parent cd5955bceb
commit 14bb2d7784
2 changed files with 12 additions and 8 deletions

View File

@ -141,21 +141,24 @@
.screen-reader-shortcut {
position: absolute;
top: -1000em;
}
.screen-reader-shortcut:focus {
left: 6px;
top: -25px;
height: auto;
width: auto;
display: block;
font-size: 14px;
font-weight: 600;
padding: 15px 23px 14px;
/* Background and color set to prevent false positives in automated accessibility tests. */
background: #f0f0f1;
color: #2271b1;
z-index: 100000;
line-height: normal;
}
.screen-reader-shortcut:focus {
top: -25px;
/* Overrides a:focus in the admin. See ticket #56789. */
color: #2271b1;
box-shadow: 0 0 2px 2px rgba(0, 0, 0, 0.6);
text-decoration: none;
/* Only visible in Windows High Contrast mode */

View File

@ -719,11 +719,7 @@ html:lang(he-il) .rtl #wpadminbar * {
#wpadminbar .screen-reader-shortcut {
position: absolute;
top: -1000em;
}
#wpadminbar .screen-reader-shortcut:focus {
left: 6px;
top: 7px;
height: auto;
width: auto;
display: block;
@ -735,6 +731,11 @@ html:lang(he-il) .rtl #wpadminbar * {
z-index: 100000;
line-height: normal;
text-decoration: none;
}
#wpadminbar .screen-reader-shortcut:focus {
top: 7px;
background: #f0f0f1;
box-shadow: 0 0 2px 2px rgba(0, 0, 0, 0.6);
}