A more modern version of visually-hidden.
This commit is contained in:
parent
9cf8765eac
commit
d423d1c7e9
1 changed files with 8 additions and 16 deletions
|
|
@ -1,24 +1,16 @@
|
||||||
// Visually hidden
|
// Visually hidden
|
||||||
//
|
//
|
||||||
// Make an element visually hidden, but accessible to screen readers, etc.
|
// Make an element visually hidden, but accessible to screen readers, etc.
|
||||||
//
|
|
||||||
// .visually-hidden--off - Turns off the visually-hidden effect.
|
|
||||||
// .visually-hidden--focusable - Makes an element visually hidden by default,
|
|
||||||
// but visible when receiving focus.
|
|
||||||
// .visually-hidden--focusable:focus - A focused, and visible, element.
|
|
||||||
|
|
||||||
.visually-hidden,
|
.visually-hidden,
|
||||||
%visually-hidden {
|
%visually-hidden {
|
||||||
@include visually-hidden();
|
&:not(:focus):not(:active) {
|
||||||
|
position: absolute;
|
||||||
&--off {
|
clip: rect(0 0 0 0);
|
||||||
@include visually-hidden--off();
|
clip-path: inset(50%);
|
||||||
}
|
height: 1px;
|
||||||
|
width: 1px;
|
||||||
&--focusable {
|
overflow: hidden;
|
||||||
&:active,
|
white-space: nowrap;
|
||||||
&:focus {
|
|
||||||
@extend %visually-hidden--off;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue