Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
jack__
committed
Aug 8, 2018
0 parents
commit 7b0cad1
Showing
5 changed files
with
113 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.DS_STORE | ||
*.log | ||
node_modules |
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,35 @@ | ||
module.exports = function({ addUtilities }) { | ||
const screenReaderUtils = { | ||
'.sr-only': { | ||
position: 'absolute', | ||
width: '1px', | ||
height: '1px', | ||
padding: '0', | ||
overflow: 'hidden', | ||
clip: 'rect(0, 0, 0, 0)', | ||
whiteSpace: 'nowrap', | ||
border: '0' | ||
}, | ||
|
||
'.sr-only-focusable': { | ||
'&:active': { | ||
position: 'static', | ||
width: 'auto', | ||
height: 'auto', | ||
overflow: 'visible', | ||
clip: 'auto', | ||
whiteSpace: 'normal' | ||
}, | ||
'&:focus': { | ||
position: 'static', | ||
width: 'auto', | ||
height: 'auto', | ||
overflow: 'visible', | ||
clip: 'auto', | ||
whiteSpace: 'normal' | ||
} | ||
} | ||
} | ||
|
||
addUtilities(screenReaderUtils) | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,27 @@ | ||
{ | ||
"name": "tailwindcss-accessibility", | ||
"version": "1.0.0", | ||
"description": "A Tailwind CSS plugin that adds additional functionality to help improve accessibility.", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/jack-pallot/tailwindcss-accessibility.git" | ||
}, | ||
"keywords": [ | ||
"tailwind", | ||
"tailwindcss", | ||
"accessibility", | ||
"a11y", | ||
"plugin" | ||
], | ||
"author": "Jack Pallot", | ||
"license": "MIT", | ||
"bugs": { | ||
"url": "https://github.com/jack-pallot/tailwindcss-accessibility/issues" | ||
}, | ||
"homepage": "https://github.com/jack-pallot/tailwindcss-accessibility#readme", | ||
"dependencies": {} | ||
} |
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,43 @@ | ||
# Tailwind CSS Accessibility Plugin | ||
|
||
A Tailwind CSS plugin that adds additional functionality to help improve accessibility. | ||
|
||
### Installing | ||
|
||
npm install tailwindcss-accessibility | ||
|
||
or | ||
|
||
yarn add tailwindcss-accessibility | ||
|
||
|
||
Simply require the installed plugin directly to your Tailwind config: | ||
|
||
plugins: [ | ||
require('tailwindcss-accessibility') | ||
] | ||
|
||
### Usage | ||
|
||
For usage on individual elements: | ||
|
||
<span class="sr-only"> | ||
Screen readers only | ||
</span> | ||
|
||
Use on focused only elements (skip links etc): | ||
|
||
<a class="sr-only sr-only-focusable" href="#content" tabindex="1"> | ||
Skip to main content | ||
</a> | ||
|
||
### Utilities | ||
|
||
By default the class utils are taken from Bootstrap 4, a highly battle-tested framework: | ||
|
||
.sr-only {} | ||
.sr-only-focusable {} | ||
|
||
### Contributions | ||
|
||
The goal of this project is to be a single source for as many relevant CSS accessibility helpers as possible. If we're missing something, or you would like to contribute, post an issue or PR. |