1 | // stylelint-disable declaration-no-important
|
2 |
|
3 | // Hide content visually while keeping it accessible to assistive technologies
|
4 | //
|
5 | // See: https://www.a11yproject.com/posts/2013-01-11-how-to-hide-content/
|
6 | // See: https://hugogiraudel.com/2016/10/13/css-hide-and-seek/
|
7 |
|
8 | @mixin visually-hidden() {
|
9 | position: absolute ;
|
10 | width: 1px ;
|
11 | height: 1px ;
|
12 | padding: 0 ;
|
13 | margin: -1px ; // Fix for https://github.com/twbs/bootstrap/issues/25686
|
14 | overflow: hidden ;
|
15 | clip: rect(0, 0, 0, 0) ;
|
16 | white-space: nowrap ;
|
17 | border: 0 ;
|
18 | }
|
19 |
|
20 | // Use to only display content when it's focused, or one of its child elements is focused
|
21 | // (i.e. when focus is within the element/container that the class was applied to)
|
22 | //
|
23 | // Useful for "Skip to main content" links; see https://www.w3.org/TR/2013/NOTE-WCAG20-TECHS-20130905/G1
|
24 |
|
25 | @mixin visually-hidden-focusable() {
|
26 | &:not(:focus):not(:focus-within) {
|
27 | @include visually-hidden();
|
28 | }
|
29 | }
|