mirror of
https://github.com/twbs/bootstrap.git
synced 2024-12-01 13:24:25 +01:00
Cleanup/fix after the sr-only to visually-hidden renaming (#31359)
* sr-only -> visually-hidden cleanup It seems the old screen-readers.md file was left behind, and forgot to rename the mixin * Fix broken mixins for visually-hidden
This commit is contained in:
parent
8aab8b7c8a
commit
cdea25584d
@ -12,7 +12,7 @@
|
||||
@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";
|
||||
|
||||
|
@ -1,11 +1,11 @@
|
||||
// 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;
|
||||
@ -21,7 +21,7 @@
|
||||
//
|
||||
// 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();
|
||||
}
|
@ -1,25 +0,0 @@
|
||||
---
|
||||
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 >}}
|
Loading…
Reference in New Issue
Block a user