adding a11y-focused sr-only and sr-only-focusable utilities

This commit is contained in:
Dave Gandy 2016-04-05 15:53:24 -05:00 committed by Brian Talbot
parent 428a6a2995
commit 72eabbc637
17 changed files with 192 additions and 12 deletions

View File

@ -1,4 +1,4 @@
# [Font Awesome v4.5.0](http://fontawesome.io) # [Font Awesome v4.6.0](http://fontawesome.io)
### The iconic font and CSS framework ### The iconic font and CSS framework
Font Awesome is a full suite of 605 pictographic icons for easy scalable vector graphics on websites, Font Awesome is a full suite of 605 pictographic icons for easy scalable vector graphics on websites,
@ -20,6 +20,7 @@ Get started at http://fontawesome.io!
- Full details: http://fontawesome.io/license/ - Full details: http://fontawesome.io/license/
## Changelog ## Changelog
- [v4.6.0 GitHub milestones](https://github.com/FortAwesome/Font-Awesome/issues?q=milestone%3A4.6.0+is%3Aclosed)
- [v4.5.0 GitHub milestones](https://github.com/FortAwesome/Font-Awesome/issues?q=milestone%3A4.5.0+is%3Aclosed) - [v4.5.0 GitHub milestones](https://github.com/FortAwesome/Font-Awesome/issues?q=milestone%3A4.5.0+is%3Aclosed)
- [v4.4.0 GitHub milestones](https://github.com/FortAwesome/Font-Awesome/issues?q=milestone%3A4.4.0+is%3Aclosed) - [v4.4.0 GitHub milestones](https://github.com/FortAwesome/Font-Awesome/issues?q=milestone%3A4.4.0+is%3Aclosed)
- [v4.3.0 GitHub milestones](https://github.com/FortAwesome/Font-Awesome/issues?q=milestone%3A4.3.0+is%3Aclosed) - [v4.3.0 GitHub milestones](https://github.com/FortAwesome/Font-Awesome/issues?q=milestone%3A4.3.0+is%3Aclosed)

25
css/font-awesome.css vendored
View File

@ -1,13 +1,13 @@
/*! /*!
* Font Awesome 4.5.0 by @davegandy - http://fontawesome.io - @fontawesome * Font Awesome 4.6.0 by @davegandy - http://fontawesome.io - @fontawesome
* License - http://fontawesome.io/license (Font: SIL OFL 1.1, CSS: MIT License) * License - http://fontawesome.io/license (Font: SIL OFL 1.1, CSS: MIT License)
*/ */
/* FONT PATH /* FONT PATH
* -------------------------- */ * -------------------------- */
@font-face { @font-face {
font-family: 'FontAwesome'; font-family: 'FontAwesome';
src: url('../fonts/fontawesome-webfont.eot?v=4.5.0'); src: url('../fonts/fontawesome-webfont.eot?v=4.6.0');
src: url('../fonts/fontawesome-webfont.eot?#iefix&v=4.5.0') format('embedded-opentype'), url('../fonts/fontawesome-webfont.woff2?v=4.5.0') format('woff2'), url('../fonts/fontawesome-webfont.woff?v=4.5.0') format('woff'), url('../fonts/fontawesome-webfont.ttf?v=4.5.0') format('truetype'), url('../fonts/fontawesome-webfont.svg?v=4.5.0#fontawesomeregular') format('svg'); src: url('../fonts/fontawesome-webfont.eot?#iefix&v=4.6.0') format('embedded-opentype'), url('../fonts/fontawesome-webfont.woff2?v=4.6.0') format('woff2'), url('../fonts/fontawesome-webfont.woff?v=4.6.0') format('woff'), url('../fonts/fontawesome-webfont.ttf?v=4.6.0') format('truetype'), url('../fonts/fontawesome-webfont.svg?v=4.6.0#fontawesomeregular') format('svg');
font-weight: normal; font-weight: normal;
font-style: normal; font-style: normal;
} }
@ -2084,3 +2084,22 @@
.fa-percent:before { .fa-percent:before {
content: "\f295"; content: "\f295";
} }
.sr-only {
position: absolute;
width: 1px;
height: 1px;
padding: 0;
margin: -1px;
overflow: hidden;
clip: rect(0, 0, 0, 0);
border: 0;
}
.sr-only-focusable:active,
.sr-only-focusable:focus {
position: static;
width: auto;
height: auto;
margin: 0;
overflow: visible;
clip: auto;
}

File diff suppressed because one or more lines are too long

View File

@ -1,5 +1,5 @@
/*! /*!
* Font Awesome 4.5.0 by @davegandy - http://fontawesome.io - @fontawesome * Font Awesome 4.6.0 by @davegandy - http://fontawesome.io - @fontawesome
* License - http://fontawesome.io/license (Font: SIL OFL 1.1, CSS: MIT License) * License - http://fontawesome.io/license (Font: SIL OFL 1.1, CSS: MIT License)
*/ */
@ -15,3 +15,4 @@
@import "rotated-flipped.less"; @import "rotated-flipped.less";
@import "stacked.less"; @import "stacked.less";
@import "icons.less"; @import "icons.less";
@import "screen-reader.less";

View File

@ -24,3 +24,37 @@
-ms-transform: scale(@horiz, @vert); -ms-transform: scale(@horiz, @vert);
transform: scale(@horiz, @vert); transform: scale(@horiz, @vert);
} }
// Only display content to screen readers. À la Bootstrap 4.
//
// See: http://a11yproject.com/posts/how-to-hide-content/
.sr-only() {
position: absolute;
width: 1px;
height: 1px;
padding: 0;
margin: -1px;
overflow: hidden;
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;
}
}

5
less/screen-reader.less Normal file
View File

@ -0,0 +1,5 @@
// Screen Readers
// -------------------------
.sr-only { .sr-only(); }
.sr-only-focusable { .sr-only-focusable(); }

View File

@ -4,9 +4,9 @@
@fa-font-path: "../fonts"; @fa-font-path: "../fonts";
@fa-font-size-base: 14px; @fa-font-size-base: 14px;
@fa-line-height-base: 1; @fa-line-height-base: 1;
//@fa-font-path: "//netdna.bootstrapcdn.com/font-awesome/4.5.0/fonts"; // for referencing Bootstrap CDN font files directly //@fa-font-path: "//netdna.bootstrapcdn.com/font-awesome/4.6.0/fonts"; // for referencing Bootstrap CDN font files directly
@fa-css-prefix: fa; @fa-css-prefix: fa;
@fa-version: "4.5.0"; @fa-version: "4.6.0";
@fa-border-color: #eee; @fa-border-color: #eee;
@fa-inverse: #fff; @fa-inverse: #fff;
@fa-li-width: (30em / 14); @fa-li-width: (30em / 14);

View File

@ -24,3 +24,37 @@
-ms-transform: scale($horiz, $vert); -ms-transform: scale($horiz, $vert);
transform: scale($horiz, $vert); transform: scale($horiz, $vert);
} }
// Only display content to screen readers. À la Bootstrap 4.
//
// See: http://a11yproject.com/posts/how-to-hide-content/
@mixin sr-only {
position: absolute;
width: 1px;
height: 1px;
padding: 0;
margin: -1px;
overflow: hidden;
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
@mixin sr-only-focusable {
&:active,
&:focus {
position: static;
width: auto;
height: auto;
margin: 0;
overflow: visible;
clip: auto;
}
}

5
scss/_screen-reader.scss Normal file
View File

@ -0,0 +1,5 @@
// Screen Readers
// -------------------------
.sr-only { @include sr-only(); }
.sr-only-focusable { @include sr-only-focusable(); }

View File

@ -4,9 +4,9 @@
$fa-font-path: "../fonts" !default; $fa-font-path: "../fonts" !default;
$fa-font-size-base: 14px !default; $fa-font-size-base: 14px !default;
$fa-line-height-base: 1 !default; $fa-line-height-base: 1 !default;
//$fa-font-path: "//netdna.bootstrapcdn.com/font-awesome/4.5.0/fonts" !default; // for referencing Bootstrap CDN font files directly //$fa-font-path: "//netdna.bootstrapcdn.com/font-awesome/4.6.0/fonts" !default; // for referencing Bootstrap CDN font files directly
$fa-css-prefix: fa !default; $fa-css-prefix: fa !default;
$fa-version: "4.5.0" !default; $fa-version: "4.6.0" !default;
$fa-border-color: #eee !default; $fa-border-color: #eee !default;
$fa-inverse: #fff !default; $fa-inverse: #fff !default;
$fa-li-width: (30em / 14) !default; $fa-li-width: (30em / 14) !default;

View File

@ -1,5 +1,5 @@
/*! /*!
* Font Awesome 4.5.0 by @davegandy - http://fontawesome.io - @fontawesome * Font Awesome 4.6.0 by @davegandy - http://fontawesome.io - @fontawesome
* License - http://fontawesome.io/license (Font: SIL OFL 1.1, CSS: MIT License) * License - http://fontawesome.io/license (Font: SIL OFL 1.1, CSS: MIT License)
*/ */
@ -15,3 +15,4 @@
@import "rotated-flipped"; @import "rotated-flipped";
@import "stacked"; @import "stacked";
@import "icons"; @import "icons";
@import "screen-reader";

View File

@ -14,3 +14,4 @@
@import "rotated-flipped.less"; @import "rotated-flipped.less";
@import "stacked.less"; @import "stacked.less";
@import "icons.less"; @import "icons.less";
@import "screen-reader.less";

View File

@ -20,3 +20,37 @@
-ms-transform: scale(@horiz, @vert); -ms-transform: scale(@horiz, @vert);
transform: scale(@horiz, @vert); transform: scale(@horiz, @vert);
} }
// Only display content to screen readers. À la Bootstrap 4.
//
// See: http://a11yproject.com/posts/how-to-hide-content/
.sr-only() {
position: absolute;
width: 1px;
height: 1px;
padding: 0;
margin: -1px;
overflow: hidden;
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;
}
}

View File

@ -0,0 +1,5 @@
// Screen Readers
// -------------------------
.sr-only { .sr-only(); }
.sr-only-focusable { .sr-only-focusable(); }

View File

@ -20,3 +20,37 @@
-ms-transform: scale($horiz, $vert); -ms-transform: scale($horiz, $vert);
transform: scale($horiz, $vert); transform: scale($horiz, $vert);
} }
// Only display content to screen readers. À la Bootstrap 4.
//
// See: http://a11yproject.com/posts/how-to-hide-content/
@mixin sr-only {
position: absolute;
width: 1px;
height: 1px;
padding: 0;
margin: -1px;
overflow: hidden;
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
@mixin sr-only-focusable {
&:active,
&:focus {
position: static;
width: auto;
height: auto;
margin: 0;
overflow: visible;
clip: auto;
}
}

View File

@ -0,0 +1,5 @@
// Screen Readers
// -------------------------
.sr-only { @include sr-only(); }
.sr-only-focusable { @include sr-only-focusable(); }

View File

@ -14,3 +14,4 @@
@import "rotated-flipped"; @import "rotated-flipped";
@import "stacked"; @import "stacked";
@import "icons"; @import "icons";
@import "screen-reader";