diff --git a/__tests__/fixtures/tailwind-output-important.css b/__tests__/fixtures/tailwind-output-important.css index 6df7a13012ed..96b0928f08c5 100644 --- a/__tests__/fixtures/tailwind-output-important.css +++ b/__tests__/fixtures/tailwind-output-important.css @@ -610,6 +610,52 @@ video { } } +.sr-only { + position: absolute !important; + width: 1px !important; + height: 1px !important; + padding: 0 !important; + margin: -1px !important; + overflow: hidden !important; + clip: rect(0, 0, 0, 0) !important; + white-space: nowrap !important; + border-width: 0 !important; +} + +.not-sr-only { + position: static !important; + width: auto !important; + height: auto !important; + padding: 0 !important; + margin: 0 !important; + overflow: visible !important; + clip: auto !important; + white-space: normal !important; +} + +.focus\:sr-only:focus { + position: absolute !important; + width: 1px !important; + height: 1px !important; + padding: 0 !important; + margin: -1px !important; + overflow: hidden !important; + clip: rect(0, 0, 0, 0) !important; + white-space: nowrap !important; + border-width: 0 !important; +} + +.focus\:not-sr-only:focus { + position: static !important; + width: auto !important; + height: auto !important; + padding: 0 !important; + margin: 0 !important; + overflow: visible !important; + clip: auto !important; + white-space: normal !important; +} + .appearance-none { appearance: none !important; } @@ -7511,6 +7557,52 @@ video { } @media (min-width: 640px) { + .sm\:sr-only { + position: absolute !important; + width: 1px !important; + height: 1px !important; + padding: 0 !important; + margin: -1px !important; + overflow: hidden !important; + clip: rect(0, 0, 0, 0) !important; + white-space: nowrap !important; + border-width: 0 !important; + } + + .sm\:not-sr-only { + position: static !important; + width: auto !important; + height: auto !important; + padding: 0 !important; + margin: 0 !important; + overflow: visible !important; + clip: auto !important; + white-space: normal !important; + } + + .sm\:focus\:sr-only:focus { + position: absolute !important; + width: 1px !important; + height: 1px !important; + padding: 0 !important; + margin: -1px !important; + overflow: hidden !important; + clip: rect(0, 0, 0, 0) !important; + white-space: nowrap !important; + border-width: 0 !important; + } + + .sm\:focus\:not-sr-only:focus { + position: static !important; + width: auto !important; + height: auto !important; + padding: 0 !important; + margin: 0 !important; + overflow: visible !important; + clip: auto !important; + white-space: normal !important; + } + .sm\:appearance-none { appearance: none !important; } @@ -14413,6 +14505,52 @@ video { } @media (min-width: 768px) { + .md\:sr-only { + position: absolute !important; + width: 1px !important; + height: 1px !important; + padding: 0 !important; + margin: -1px !important; + overflow: hidden !important; + clip: rect(0, 0, 0, 0) !important; + white-space: nowrap !important; + border-width: 0 !important; + } + + .md\:not-sr-only { + position: static !important; + width: auto !important; + height: auto !important; + padding: 0 !important; + margin: 0 !important; + overflow: visible !important; + clip: auto !important; + white-space: normal !important; + } + + .md\:focus\:sr-only:focus { + position: absolute !important; + width: 1px !important; + height: 1px !important; + padding: 0 !important; + margin: -1px !important; + overflow: hidden !important; + clip: rect(0, 0, 0, 0) !important; + white-space: nowrap !important; + border-width: 0 !important; + } + + .md\:focus\:not-sr-only:focus { + position: static !important; + width: auto !important; + height: auto !important; + padding: 0 !important; + margin: 0 !important; + overflow: visible !important; + clip: auto !important; + white-space: normal !important; + } + .md\:appearance-none { appearance: none !important; } @@ -21315,6 +21453,52 @@ video { } @media (min-width: 1024px) { + .lg\:sr-only { + position: absolute !important; + width: 1px !important; + height: 1px !important; + padding: 0 !important; + margin: -1px !important; + overflow: hidden !important; + clip: rect(0, 0, 0, 0) !important; + white-space: nowrap !important; + border-width: 0 !important; + } + + .lg\:not-sr-only { + position: static !important; + width: auto !important; + height: auto !important; + padding: 0 !important; + margin: 0 !important; + overflow: visible !important; + clip: auto !important; + white-space: normal !important; + } + + .lg\:focus\:sr-only:focus { + position: absolute !important; + width: 1px !important; + height: 1px !important; + padding: 0 !important; + margin: -1px !important; + overflow: hidden !important; + clip: rect(0, 0, 0, 0) !important; + white-space: nowrap !important; + border-width: 0 !important; + } + + .lg\:focus\:not-sr-only:focus { + position: static !important; + width: auto !important; + height: auto !important; + padding: 0 !important; + margin: 0 !important; + overflow: visible !important; + clip: auto !important; + white-space: normal !important; + } + .lg\:appearance-none { appearance: none !important; } @@ -28217,6 +28401,52 @@ video { } @media (min-width: 1280px) { + .xl\:sr-only { + position: absolute !important; + width: 1px !important; + height: 1px !important; + padding: 0 !important; + margin: -1px !important; + overflow: hidden !important; + clip: rect(0, 0, 0, 0) !important; + white-space: nowrap !important; + border-width: 0 !important; + } + + .xl\:not-sr-only { + position: static !important; + width: auto !important; + height: auto !important; + padding: 0 !important; + margin: 0 !important; + overflow: visible !important; + clip: auto !important; + white-space: normal !important; + } + + .xl\:focus\:sr-only:focus { + position: absolute !important; + width: 1px !important; + height: 1px !important; + padding: 0 !important; + margin: -1px !important; + overflow: hidden !important; + clip: rect(0, 0, 0, 0) !important; + white-space: nowrap !important; + border-width: 0 !important; + } + + .xl\:focus\:not-sr-only:focus { + position: static !important; + width: auto !important; + height: auto !important; + padding: 0 !important; + margin: 0 !important; + overflow: visible !important; + clip: auto !important; + white-space: normal !important; + } + .xl\:appearance-none { appearance: none !important; } diff --git a/__tests__/fixtures/tailwind-output.css b/__tests__/fixtures/tailwind-output.css index 91809f2edcbb..8ca3bf3566c9 100644 --- a/__tests__/fixtures/tailwind-output.css +++ b/__tests__/fixtures/tailwind-output.css @@ -610,6 +610,52 @@ video { } } +.sr-only { + position: absolute; + width: 1px; + height: 1px; + padding: 0; + margin: -1px; + overflow: hidden; + clip: rect(0, 0, 0, 0); + white-space: nowrap; + border-width: 0; +} + +.not-sr-only { + position: static; + width: auto; + height: auto; + padding: 0; + margin: 0; + overflow: visible; + clip: auto; + white-space: normal; +} + +.focus\:sr-only:focus { + position: absolute; + width: 1px; + height: 1px; + padding: 0; + margin: -1px; + overflow: hidden; + clip: rect(0, 0, 0, 0); + white-space: nowrap; + border-width: 0; +} + +.focus\:not-sr-only:focus { + position: static; + width: auto; + height: auto; + padding: 0; + margin: 0; + overflow: visible; + clip: auto; + white-space: normal; +} + .appearance-none { appearance: none; } @@ -7511,6 +7557,52 @@ video { } @media (min-width: 640px) { + .sm\:sr-only { + position: absolute; + width: 1px; + height: 1px; + padding: 0; + margin: -1px; + overflow: hidden; + clip: rect(0, 0, 0, 0); + white-space: nowrap; + border-width: 0; + } + + .sm\:not-sr-only { + position: static; + width: auto; + height: auto; + padding: 0; + margin: 0; + overflow: visible; + clip: auto; + white-space: normal; + } + + .sm\:focus\:sr-only:focus { + position: absolute; + width: 1px; + height: 1px; + padding: 0; + margin: -1px; + overflow: hidden; + clip: rect(0, 0, 0, 0); + white-space: nowrap; + border-width: 0; + } + + .sm\:focus\:not-sr-only:focus { + position: static; + width: auto; + height: auto; + padding: 0; + margin: 0; + overflow: visible; + clip: auto; + white-space: normal; + } + .sm\:appearance-none { appearance: none; } @@ -14413,6 +14505,52 @@ video { } @media (min-width: 768px) { + .md\:sr-only { + position: absolute; + width: 1px; + height: 1px; + padding: 0; + margin: -1px; + overflow: hidden; + clip: rect(0, 0, 0, 0); + white-space: nowrap; + border-width: 0; + } + + .md\:not-sr-only { + position: static; + width: auto; + height: auto; + padding: 0; + margin: 0; + overflow: visible; + clip: auto; + white-space: normal; + } + + .md\:focus\:sr-only:focus { + position: absolute; + width: 1px; + height: 1px; + padding: 0; + margin: -1px; + overflow: hidden; + clip: rect(0, 0, 0, 0); + white-space: nowrap; + border-width: 0; + } + + .md\:focus\:not-sr-only:focus { + position: static; + width: auto; + height: auto; + padding: 0; + margin: 0; + overflow: visible; + clip: auto; + white-space: normal; + } + .md\:appearance-none { appearance: none; } @@ -21315,6 +21453,52 @@ video { } @media (min-width: 1024px) { + .lg\:sr-only { + position: absolute; + width: 1px; + height: 1px; + padding: 0; + margin: -1px; + overflow: hidden; + clip: rect(0, 0, 0, 0); + white-space: nowrap; + border-width: 0; + } + + .lg\:not-sr-only { + position: static; + width: auto; + height: auto; + padding: 0; + margin: 0; + overflow: visible; + clip: auto; + white-space: normal; + } + + .lg\:focus\:sr-only:focus { + position: absolute; + width: 1px; + height: 1px; + padding: 0; + margin: -1px; + overflow: hidden; + clip: rect(0, 0, 0, 0); + white-space: nowrap; + border-width: 0; + } + + .lg\:focus\:not-sr-only:focus { + position: static; + width: auto; + height: auto; + padding: 0; + margin: 0; + overflow: visible; + clip: auto; + white-space: normal; + } + .lg\:appearance-none { appearance: none; } @@ -28217,6 +28401,52 @@ video { } @media (min-width: 1280px) { + .xl\:sr-only { + position: absolute; + width: 1px; + height: 1px; + padding: 0; + margin: -1px; + overflow: hidden; + clip: rect(0, 0, 0, 0); + white-space: nowrap; + border-width: 0; + } + + .xl\:not-sr-only { + position: static; + width: auto; + height: auto; + padding: 0; + margin: 0; + overflow: visible; + clip: auto; + white-space: normal; + } + + .xl\:focus\:sr-only:focus { + position: absolute; + width: 1px; + height: 1px; + padding: 0; + margin: -1px; + overflow: hidden; + clip: rect(0, 0, 0, 0); + white-space: nowrap; + border-width: 0; + } + + .xl\:focus\:not-sr-only:focus { + position: static; + width: auto; + height: auto; + padding: 0; + margin: 0; + overflow: visible; + clip: auto; + white-space: normal; + } + .xl\:appearance-none { appearance: none; } diff --git a/src/corePlugins.js b/src/corePlugins.js index 270b843acfcb..3aef64f70a4f 100644 --- a/src/corePlugins.js +++ b/src/corePlugins.js @@ -1,5 +1,6 @@ import preflight from './plugins/preflight' import container from './plugins/container' +import accessibility from './plugins/accessibility' import appearance from './plugins/appearance' import backgroundAttachment from './plugins/backgroundAttachment' import backgroundColor from './plugins/backgroundColor' @@ -71,6 +72,7 @@ export default function({ corePlugins: corePluginConfig }) { return configurePlugins(corePluginConfig, { preflight, container, + accessibility, appearance, backgroundAttachment, backgroundColor, diff --git a/src/plugins/accessibility.js b/src/plugins/accessibility.js new file mode 100644 index 000000000000..8c634869cbcc --- /dev/null +++ b/src/plugins/accessibility.js @@ -0,0 +1,30 @@ +export default function() { + return function({ addUtilities, variants }) { + addUtilities( + { + '.sr-only': { + position: 'absolute', + width: '1px', + height: '1px', + padding: '0', + margin: '-1px', + overflow: 'hidden', + clip: 'rect(0, 0, 0, 0)', + whiteSpace: 'nowrap', + borderWidth: '0', + }, + '.not-sr-only': { + position: 'static', + width: 'auto', + height: 'auto', + padding: '0', + margin: '0', + overflow: 'visible', + clip: 'auto', + whiteSpace: 'normal', + }, + }, + variants('accessibility') + ) + } +} diff --git a/stubs/defaultConfig.stub.js b/stubs/defaultConfig.stub.js index b4de4fafca60..2b68d51796d9 100644 --- a/stubs/defaultConfig.stub.js +++ b/stubs/defaultConfig.stub.js @@ -418,6 +418,7 @@ module.exports = { }, }, variants: { + accessibility: ['responsive', 'focus'], alignContent: ['responsive'], alignItems: ['responsive'], alignSelf: ['responsive'],