-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #220 from hypothesis/a11y-css
Bring accessibility- and focus-related mixins and utils into package
- Loading branch information
Showing
4 changed files
with
37 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// Hide content from sighted users but make it visible to screen readers. | ||
// | ||
// Resources: | ||
// - https://webaim.org/techniques/css/invisiblecontent/ (see "CSS clip") | ||
// - https://cloudfour.com/thinks/see-no-evil-hidden-content-and-accessibility/#showing-additional-content-for-screen-readers | ||
@mixin screen-reader-only { | ||
// Take the content out of the normal layout flow. | ||
position: absolute; | ||
width: 1px; | ||
height: 1px; | ||
white-space: nowrap; | ||
|
||
// Visually hide the content and prevent it from interfering with mouse/touch | ||
// text selection by clipping it to an empty box. Compared to moving content with | ||
// `top`/`left` this is less likely to cause the browser to scroll to a | ||
// different part of the page when the hidden text has screen-reader focus. | ||
clip: rect(0 0 0 0); | ||
overflow: hidden; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
@use '../mixins/a11y'; | ||
|
||
.hyp-u-screen-reader-only { | ||
@include a11y.screen-reader-only; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
@use 'a11y'; | ||
@use 'atoms'; | ||
@use 'colors'; | ||
@use 'focus'; | ||
|