Skip to content

Commit

Permalink
adding a11y-focused sr-only and sr-only-focusable utilities
Browse files Browse the repository at this point in the history
  • Loading branch information
davegandy authored and talbs committed Apr 6, 2016
1 parent 428a6a2 commit 72eabbc
Show file tree
Hide file tree
Showing 17 changed files with 192 additions and 12 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -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

Font Awesome is a full suite of 605 pictographic icons for easy scalable vector graphics on websites,
Expand All @@ -20,6 +20,7 @@ Get started at http://fontawesome.io!
- Full details: http://fontawesome.io/license/

## 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.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)
Expand Down
25 changes: 22 additions & 3 deletions css/font-awesome.css
Original file line number Diff line number Diff line change
@@ -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)
*/
/* FONT PATH
* -------------------------- */
@font-face {
font-family: 'FontAwesome';
src: url('../fonts/fontawesome-webfont.eot?v=4.5.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?v=4.6.0');
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-style: normal;
}
Expand Down Expand Up @@ -2084,3 +2084,22 @@
.fa-percent:before {
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;
}
4 changes: 2 additions & 2 deletions css/font-awesome.min.css

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion less/font-awesome.less
Original file line number Diff line number Diff line change
@@ -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)
*/

Expand All @@ -15,3 +15,4 @@
@import "rotated-flipped.less";
@import "stacked.less";
@import "icons.less";
@import "screen-reader.less";
34 changes: 34 additions & 0 deletions less/mixins.less
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,37 @@
-ms-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 changes: 5 additions & 0 deletions less/screen-reader.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// Screen Readers
// -------------------------

.sr-only { .sr-only(); }
.sr-only-focusable { .sr-only-focusable(); }
4 changes: 2 additions & 2 deletions less/variables.less
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
@fa-font-path: "../fonts";
@fa-font-size-base: 14px;
@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-version: "4.5.0";
@fa-version: "4.6.0";
@fa-border-color: #eee;
@fa-inverse: #fff;
@fa-li-width: (30em / 14);
Expand Down
34 changes: 34 additions & 0 deletions scss/_mixins.scss
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,37 @@
-ms-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 changes: 5 additions & 0 deletions scss/_screen-reader.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// Screen Readers
// -------------------------

.sr-only { @include sr-only(); }
.sr-only-focusable { @include sr-only-focusable(); }
4 changes: 2 additions & 2 deletions scss/_variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
$fa-font-path: "../fonts" !default;
$fa-font-size-base: 14px !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-version: "4.5.0" !default;
$fa-version: "4.6.0" !default;
$fa-border-color: #eee !default;
$fa-inverse: #fff !default;
$fa-li-width: (30em / 14) !default;
Expand Down
3 changes: 2 additions & 1 deletion scss/font-awesome.scss
Original file line number Diff line number Diff line change
@@ -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)
*/

Expand All @@ -15,3 +15,4 @@
@import "rotated-flipped";
@import "stacked";
@import "icons";
@import "screen-reader";
1 change: 1 addition & 0 deletions src/assets/font-awesome/less/font-awesome.less
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@
@import "rotated-flipped.less";
@import "stacked.less";
@import "icons.less";
@import "screen-reader.less";
34 changes: 34 additions & 0 deletions src/assets/font-awesome/less/mixins.less
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,37 @@
-ms-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 changes: 5 additions & 0 deletions src/assets/font-awesome/less/screen-reader.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// Screen Readers
// -------------------------

.sr-only { .sr-only(); }
.sr-only-focusable { .sr-only-focusable(); }
34 changes: 34 additions & 0 deletions src/assets/font-awesome/scss/_mixins.scss
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,37 @@
-ms-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 changes: 5 additions & 0 deletions src/assets/font-awesome/scss/_screen-reader.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// Screen Readers
// -------------------------

.sr-only { @include sr-only(); }
.sr-only-focusable { @include sr-only-focusable(); }
1 change: 1 addition & 0 deletions src/assets/font-awesome/scss/font-awesome.scss
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@
@import "rotated-flipped";
@import "stacked";
@import "icons";
@import "screen-reader";

0 comments on commit 72eabbc

Please sign in to comment.