-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add docs covering visually hidden helper standalone
- Loading branch information
1 parent
5beb68a
commit aa77c40
Showing
4 changed files
with
65 additions
and
3 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
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,25 @@ | ||
--- | ||
title: Visually hidden text | ||
--- | ||
|
||
markdown: | ||
Most of the time content should be both visible on the screen and availble to | ||
screen readers. However, somtimes when space is at a premium, we may want | ||
to hide text that would clutter the screen. This puts users of assistive | ||
technology like screen readers at a disadvantage. | ||
|
||
We can hide content but make it available to users of assistive technology | ||
using the `govuk-visually-hidden` class. This library provides a helper method | ||
which makes hiding content easier. | ||
|
||
== render('/partials/example.*', | ||
caption: "Setting visually hidden text with an argument", | ||
code: visually_hidden_text_via_argument) | ||
|
||
== render('/partials/example.*', | ||
caption: "Setting visually hidden text with a block", | ||
code: visually_hidden_text_via_block) | ||
|
||
== render('/partials/example.*', | ||
caption: "Focusable visually hidden text", | ||
code: focusable_visually_hidden_text) |
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,37 @@ | ||
module Examples | ||
module VisuallyHiddenHelpers | ||
def visually_hidden_text_via_argument | ||
<<~SNIPPET | ||
p Regular text | ||
= govuk_visually_hidden("This content is visually hidden") | ||
p More regular text | ||
SNIPPET | ||
end | ||
|
||
def visually_hidden_text_via_block | ||
<<~SNIPPET | ||
p Regular text | ||
= govuk_visually_hidden do | ||
p This paragraph is visually hidden | ||
p More regular text | ||
SNIPPET | ||
end | ||
|
||
def focusable_visually_hidden_text | ||
<<~SNIPPET | ||
p Regular text | ||
p | ||
a href="#" | ||
| Some link | ||
= govuk_visually_hidden("Focus on me", focusable: true) | ||
p More regular text | ||
SNIPPET | ||
end | ||
end | ||
end |
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