@import "mixins/breakpoints";
@import "mixins/image";
@import "mixins/resize";
-@import "mixins/screen-reader";
+@import "mixins/visually-hidden";
@import "mixins/reset-text";
@import "mixins/text-truncate";
// stylelint-disable declaration-no-important
-// Only display content to screen readers
+// Hide content visually while keeping it accessible to assistive technologies
//
// See: https://a11yproject.com/posts/how-to-hide-content/
// See: https://hugogiraudel.com/2016/10/13/css-hide-and-seek/
-@mixin visually-hidden {
+@mixin visually-hidden() {
position: absolute !important;
width: 1px !important;
height: 1px !important;
//
// Useful for "Skip to main content" links; see https://www.w3.org/TR/2013/NOTE-WCAG20-TECHS-20130905/G1
-@mixin visually-hidden-focusable {
+@mixin visually-hidden-focusable() {
&:not(:focus) {
@include visually-hidden();
}
+++ /dev/null
----
-layout: docs
-title: Screen readers
-description: Use screen reader utilities to hide elements on all devices except screen readers.
-group: helpers
----
-
-Hide an element to all devices **except screen readers** with `.visually-hidden`. Use `.visually-hidden-focusable` to show the element only when it's focused (e.g. by a keyboard-only user). Can also be used as mixins.
-
-{{< example >}}
-<h2 class="visually-hidden">Title for screen readers</h2>
-<a class="visually-hidden-focusable" href="#content">Skip to main content</a>
-{{< /example >}}
-
-{{< highlight scss >}}
-// Usage as a mixin
-
-.visually-hidden-title {
- @include visually-hidden;
-}
-
-.skip-navigation {
- @include visually-hidden-focusable;
-}
-{{< /highlight >}}