Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docs: screen reader helper/visibility utility tweaks #31133

Merged
merged 7 commits into from Jul 10, 2020
Merged
2 changes: 1 addition & 1 deletion scss/_helpers.scss
Expand Up @@ -2,6 +2,6 @@
@import "helpers/colored-links";
@import "helpers/embed";
@import "helpers/position";
@import "helpers/screenreaders";
@import "helpers/visually-hidden";
@import "helpers/stretched-link";
@import "helpers/text-truncation";
@@ -1,5 +1,5 @@
//
// Screenreaders
// Visually hidden
//

.visually-hidden,
Expand Down
2 changes: 1 addition & 1 deletion site/content/docs/5.0/forms/layout.md
Expand Up @@ -297,7 +297,7 @@ You can then remix that once again with size-specific column classes.

Use the `.col-auto` class to create horizontal layouts. By adding [gutter modifier classes]({{< docsref "/layout/gutters" >}}), we'll have gutters in horizontal and vertical directions. The `.align-items-center` aligns the form elements to the middle, making the `.form-checkbox` align properly.

Be sure to always include a `<label>` with each form control, even if you need to hide it from non-screenreader visitors with `.visually-hidden`.
Be sure to always include a `<label>` with each form control, even if you need to visually hide it with `.visually-hidden` (which still keeps it available to assistive technologies such as screen readers).

{{< example >}}
<form class="row row-cols-md-auto g-3 align-items-center">
Expand Down
26 changes: 26 additions & 0 deletions site/content/docs/5.0/helpers/visually-hidden.md
@@ -0,0 +1,26 @@
---
layout: docs
title: Visually hidden
description: Use these helpers to visually hide elements but keep them accessible to assistive technologies.
group: helpers
aliases: "/docs/5.0/helpers/screen-readers/"
---

Visually hide an element while still allowing it to be exposed to assistive technologies (such as screen readers) with `.visually-hidden`. Use `.visually-hidden-focusable` to visually hide an element by default, but to display it 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 >}}
8 changes: 6 additions & 2 deletions site/content/docs/5.0/utilities/visibility.md
@@ -1,11 +1,15 @@
---
layout: docs
title: Visibility
description: Control the visibility, without modifying the display, of elements with visibility utilities.
description: Control the visibility of elements, without modifying their display, with visibility utilities.
group: utilities
---

Set the `visibility` of elements with our visibility utilities. These utility classes do not modify the `display` value at all and do not affect layout – `.invisible` elements still take up space in the page. Content will be hidden both visually and for assistive technology/screen reader users.
Set the `visibility` of elements with our visibility utilities. These utility classes do not modify the `display` value at all and do not affect layout – `.invisible` elements still take up space in the page.

{{< callout warning >}}
Elements with the `.invisible` class will be hidden *both* visually and for assistive technology/screen reader users.
{{< /callout >}}

Apply `.visible` or `.invisible` as needed.

Expand Down
2 changes: 1 addition & 1 deletion site/data/sidebar.yml
Expand Up @@ -81,7 +81,7 @@
- title: Colored links
- title: Embed
- title: Position
- title: Screen readers
- title: Visually hidden
- title: Stretched link
- title: Text truncation

Expand Down