This repository has been archived by the owner on Jun 20, 2022. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 101
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(a11y): support "prefers-reduce-motion"
Also add "transitionEnabled" in theme Also add documentation about accessiblity. Closes #39
- Loading branch information
Showing
9 changed files
with
80 additions
and
15 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,48 @@ | ||
--- | ||
name: Accessiblity | ||
menu: 1. Basics | ||
order: 6 | ||
--- | ||
|
||
import { Playground } from 'docz' | ||
|
||
# Accessiblity | ||
|
||
Smooth UI takes accessibility seriously. We do our best to ensure that all components are the most accessible for everyone and on all devices. | ||
|
||
## Reduce motion preference | ||
|
||
All components implement [reduced motion media query](https://css-tricks.com/introduction-reduced-motion-media-query/), it means they respect settings of users. | ||
|
||
`transition` mixin automatically adds the reduced motion media query. | ||
|
||
```js | ||
import { mixin } from '@smooth-ui/core-sc' | ||
|
||
const AccessibleButton = styled.button` | ||
background-color: red; | ||
${mixin('transition', 'background-color 200ms')}; | ||
&:hover { | ||
background-color: blue; | ||
} | ||
` | ||
|
||
/* | ||
CSS injected in the page will be: | ||
background-color: red; | ||
transition: background-color 200ms; | ||
@media screen and (prefers-reduced-motion: reduce) { | ||
transition: none; | ||
} | ||
&:hover { | ||
background-color: blue; | ||
} | ||
*/ | ||
``` | ||
|
||
## Turn off all transitions | ||
|
||
You can also choose to turn off all transitions by setting `transitionEnabled` to `false` in theme. See [theming guide](http://localhost:3000/docs-basics-theming). |
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
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
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
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
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
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
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
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