Skip to content

Commit 797421c

Browse files
committed
adds visibility helpers
1 parent 51a2f13 commit 797421c

File tree

1 file changed

+50
-0
lines changed

1 file changed

+50
-0
lines changed

helpers/_visibility.scss

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
/*
2+
* Hide visually and from screen readers:
3+
* http://juicystudio.com/article/screen-readers-display-none.php
4+
*/
5+
6+
.hidden {
7+
display: none !important;
8+
visibility: hidden;
9+
}
10+
11+
/*
12+
* Hide only visually, but have it available for screen readers:
13+
* http://snook.ca/archives/html_and_css/hiding-content-for-accessibility
14+
*/
15+
16+
.visuallyhidden {
17+
border: 0;
18+
clip: rect(0 0 0 0);
19+
height: 1px;
20+
margin: -1px;
21+
overflow: hidden;
22+
padding: 0;
23+
position: absolute;
24+
width: 1px;
25+
}
26+
27+
/*
28+
* Extends the .visuallyhidden class to allow the element
29+
* to be focusable when navigated to via the keyboard:
30+
* https://www.drupal.org/node/897638
31+
*/
32+
33+
.visuallyhidden.focusable:active,
34+
.visuallyhidden.focusable:focus {
35+
clip: auto;
36+
height: auto;
37+
margin: 0;
38+
overflow: visible;
39+
position: static;
40+
width: auto;
41+
}
42+
43+
/*
44+
* Hide visually and from screen readers, but maintain layout
45+
*/
46+
47+
.invisible {
48+
visibility: hidden;
49+
}
50+

0 commit comments

Comments
 (0)