1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-12-02 13:23:29 +01:00

A11y: use visually hidden styles rather than visibility

- `visibility:hidden` also hides text from assistive technologies, leading to the settings link lacking an accessible name when not hovered (focused with keyboard only, for instance)
- turn the styles around and hide the non-hovered link's span with "visually hidden" styles https://www.a11yproject.com/posts/2013-01-11-how-to-hide-content/
- also include `:focus` to make the text visible when hovered (for sighted keyboard users)
This commit is contained in:
Patrick H. Lauke 2021-07-31 21:56:05 +01:00
parent 1b12a278cf
commit 888fc74a57

View File

@ -50,20 +50,25 @@ app-home {
color: themed('mutedColor'); color: themed('mutedColor');
} }
span { &:not(:hover):not(:focus) {
visibility: hidden; span {
clip: rect(0 0 0 0);
clip-path: inset(50%);
height: 1px;
overflow: hidden;
position: absolute;
white-space: nowrap;
width: 1px;
}
} }
&:hover { &:hover, &:focus {
text-decoration: none; text-decoration: none;
@include themify($themes) { @include themify($themes) {
color: themed('primaryColor'); color: themed('primaryColor');
} }
span {
visibility: visible;
}
} }
} }
} }