| 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://kittygiraudel.com/2016/10/13/css-hide-and-seek/ |
| 7 |
|
| 8 |
@mixin visually-hidden() { |
| 9 |
width: 1px !important; |
| 10 |
height: 1px !important; |
| 11 |
padding: 0 !important; |
| 12 |
margin: -1px !important; // Fix for https://github.com/twbs/bootstrap/issues/25686 |
| 13 |
overflow: hidden !important; |
| 14 |
clip: rect(0, 0, 0, 0) !important; |
| 15 |
white-space: nowrap !important; |
| 16 |
border: 0 !important; |
| 17 |
|
| 18 |
// Fix for positioned table caption that could become anonymous cells |
| 19 |
&:not(caption) { |
| 20 |
position: absolute !important; |
| 21 |
} |
| 22 |
} |
| 23 |
|
| 24 |
// Use to only display content when it's focused, or one of its child elements is focused |
| 25 |
// (i.e. when focus is within the element/container that the class was applied to) |
| 26 |
// |
| 27 |
// Useful for "Skip to main content" links; see https://www.w3.org/TR/2013/NOTE-WCAG20-TECHS-20130905/G1 |
| 28 |
|
| 29 |
@mixin visually-hidden-focusable() { |
| 30 |
&:not(:focus):not(:focus-within) { |
| 31 |
@include visually-hidden(); |
| 32 |
} |
| 33 |
} |