Line | |
---|
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 | position: absolute !important;
|
---|
10 | width: 1px !important;
|
---|
11 | height: 1px !important;
|
---|
12 | padding: 0 !important;
|
---|
13 | margin: -1px !important; // Fix for https://github.com/twbs/bootstrap/issues/25686
|
---|
14 | overflow: hidden !important;
|
---|
15 | clip: rect(0, 0, 0, 0) !important;
|
---|
16 | white-space: nowrap !important;
|
---|
17 | border: 0 !important;
|
---|
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 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.