Skip to content

Commit f26b09c

Browse files
committed
add show-on-focus utility
1 parent 31c14f0 commit f26b09c

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

packages/primer-utilities/lib/visibility-display.scss

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,6 @@
8181
// Only display content to screen readers
8282
//
8383
// See: http://a11yproject.com/posts/how-to-hide-content/
84-
8584
.sr-only {
8685
position: absolute;
8786
width: 1px;
@@ -93,3 +92,20 @@
9392
word-wrap: normal;
9493
border: 0;
9594
}
95+
96+
// Only display content on focus
97+
.show-on-focus {
98+
position: absolute;
99+
width: 1px;
100+
height: 1px;
101+
margin: 0;
102+
overflow: hidden;
103+
clip: rect(1px, 1px, 1px, 1px);
104+
105+
&:focus {
106+
z-index: 20;
107+
width: auto;
108+
height: auto;
109+
clip: auto;
110+
}
111+
}

0 commit comments

Comments
 (0)