Skip to content

add .sr-only-focusable #12679

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

Merged
merged 4 commits into from
Mar 9, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions dist/css/bootstrap-rtl.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/css/bootstrap-rtl.min.css

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions dist/css/bootstrap.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/css/bootstrap.css.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/css/bootstrap.min.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/_layouts/default.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
{% include header.html %}
</head>
<body>
<a class="sr-only" href="#content">Skip to main content</a>
<a class="sr-only sr-only-focusable" href="#content">Skip to main content</a>

<!-- Docs master nav -->
{% include nav-main.html %}
Expand Down
2 changes: 1 addition & 1 deletion docs/_layouts/home.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
{% include header.html %}
</head>
<body class="bs-docs-home">
<a class="sr-only" href="#content">Skip to main content</a>
<a class="sr-only sr-only-focusable" href="#content">Skip to main content</a>

<!-- Docs master nav -->
{% include nav-main.html %}
Expand Down
2 changes: 1 addition & 1 deletion docs/assets/js/raw-files.min.js

Large diffs are not rendered by default.

7 changes: 4 additions & 3 deletions docs/css.html
Original file line number Diff line number Diff line change
Expand Up @@ -2611,15 +2611,16 @@ <h3 id="helper-classes-show-hide">Showing and hiding content</h3>
{% endhighlight %}


<h3 id="helper-classes-screen-readers">Screen reader content</h3>
<p>Hide an element to all devices <strong>except screen readers</strong> with <code>.sr-only</code>. Necessary for following <a href="../getting-started/#accessibility">accessibility best practices</a>. Can also be used as a mixin.</p>
<h3 id="helper-classes-screen-readers">Screen reader and keyboard navigation content</h3>
<p>Hide an element to all devices <strong>except screen readers</strong> with <code>.sr-only</code>. Combine <code>.sr-only</code> with <code>.sr-only-focusable</code> to show the element again when it's focused (e.g. by a keyboard-only user). Necessary for following <a href="../getting-started/#accessibility">accessibility best practices</a>. Can also be used as mixins.</p>
{% highlight html %}
<a class="sr-only" href="#content">Skip to main content</a>
<a class="sr-only sr-only-focusable" href="#content">Skip to main content</a>
{% endhighlight %}
{% highlight scss %}
// Usage as a Mixin
.skip-navigation {
.sr-only();
.sr-only-focusable();
}
{% endhighlight %}

Expand Down
2 changes: 1 addition & 1 deletion docs/dist/css/bootstrap-rtl.min.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/dist/css/bootstrap.css.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/dist/css/bootstrap.min.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/getting-started.html
Original file line number Diff line number Diff line change
Expand Up @@ -621,7 +621,7 @@ <h3>Skip navigation</h3>
<p>If your navigation contains many links and comes before the main content in the DOM, add a <code>Skip to main content</code> link immediately after your opening <code>&lt;body&gt;</code> tag. <a href="http://a11yproject.com/posts/skip-nav-links/">(read why)</a></p>
{% highlight html %}
<body>
<a href="#content" class="sr-only">Skip to main content</a>
<a href="#content" class="sr-only sr-only-focusable">Skip to main content</a>
<div class="container" id="content">
The main page content.
</div>
Expand Down
16 changes: 16 additions & 0 deletions less/scaffolding.less
Original file line number Diff line number Diff line change
Expand Up @@ -132,3 +132,19 @@ hr {
clip: rect(0,0,0,0);
border: 0;
}

// Use in conjunction with .sr-only to only display content when it's focused.
// Useful for "Skip to main content" links; see http://www.w3.org/TR/2013/NOTE-WCAG20-TECHS-20130905/G1
// Credit: HTML5 Boilerplate

.sr-only-focusable {
&:active,
&:focus {
position: static;
width: auto;
height: auto;
margin: 0;
overflow: visible;
clip: auto;
}
}