-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add accessibility docs, add some options links
- Loading branch information
1 parent
e5900ac
commit fb29e9e
Showing
14 changed files
with
202 additions
and
41 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 |
---|---|---|
|
@@ -17,5 +17,6 @@ pnpm-debug.log* | |
.env | ||
.env.production | ||
|
||
# macOS-specific files | ||
# OS-specific files | ||
.DS_Store | ||
*.Identifier |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
--- | ||
title: 'Accessibility (a11y)' | ||
description: 'Information on the accessibility of this RangeSlider component' | ||
--- | ||
|
||
import '~styles/steps-table.scss'; | ||
import { Code } from 'astro/components'; | ||
import Info from '~components/Reusable/Info.astro' | ||
import RangeSlider from 'svelte-range-slider-pips'; | ||
import Demo from '~components/Reusable/Demo.svelte'; | ||
|
||
This RangeSlider is built with accessibility in mind. **I've done my best to follow the guidelines | ||
set out by the [**W3C**](https://www.w3.org/WAI/ARIA/apg/patterns/slider-multithumb/)** and [MDN](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/Slider_role). | ||
and have done some testing myself with VoiceOver on macOS and screen readers. | ||
|
||
<Info>I am not a person with difficulties in accessibility, however, so I **can't really say with certainty** how well this | ||
component works for people with impairments. But I have followed guidelines to the best I know. | ||
**If you are an accessible user, and would like to feedback, please do**!</Info> | ||
|
||
I am aiming for this to be _THE_ accessible RangeSlider | ||
component for the web, so if you have any feedback, please [open an issue](https://github.com/simeydotme/svelte-range-slider-pips/issues) or drop by the discussion | ||
on [GitHub Discussions](https://github.com/simeydotme/svelte-range-slider-pips/discussions) and let me know! If you are able to contribute in any way to make this the | ||
best it can be for people with impairments, I thank you so much! | ||
|
||
## Keyboard support | ||
|
||
|
||
|
||
<Demo name="Keyboard Support Tester" client:visible> | ||
<RangeSlider id="a11y-slider" values={[-10,10]} range min={-20} max={20} pips all="label" pipstep={5} client:visible /> | ||
</Demo> | ||
|
||
The RangeSlider supports the following keyboard shortcuts. | ||
_(use the slider above to test them out)_ | ||
|
||
- <kbd title="Tab key">Tab ⭲</kbd> Move focus to next handle | ||
- <kbd title="Left arrow">Left ←</kbd> Decrease value by `1` | ||
- <kbd title="Right arrow">Right →</kbd> Increase value by `1` | ||
- <kbd title="Shift">Shift</kbd><kbd title="Left arrow">Left ←</kbd> Decrease value by 10% | ||
- <kbd title="Shift">Shift</kbd><kbd title="Right arrow">Right →</kbd> Increase value by 10% | ||
- <kbd title="Page Up">Page Up</kbd> Increase value by 10% | ||
- <kbd title="Page Down">Page Dn</kbd> Decrease value by 10% | ||
- <kbd title="Home">Home</kbd> Set value to `min` | ||
- <kbd title="End">End</kbd> Set value to `max` | ||
|
||
|
||
## Aria Labels | ||
|
||
It's possible to provide a list of labels for the handles to be read out by screen readers. | ||
This is done by passing an array of strings to the `aria-labels` prop. | ||
|
||
Read [more about `aria-label` here](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-label) , and | ||
specifically for the [slider role here](https://www.w3.org/WAI/ARIA/apg/patterns/slider-multithumb/examples/slider-multithumb/#rps_label). | ||
|
||
Generally speaking, set the `ariaLabels` prop to a label **which describes the purpose of the handle**. For example, if the handle | ||
is controlling the volume of a video, you might set the `aria-label` to "Volume". | ||
|
||
eg; `ariaLabels={['Volume']}` | ||
### `ariaLabels` example | ||
|
||
<Demo name="Aria Label Example" client:visible> | ||
<RangeSlider ariaLabels={['Volume']} client:visible /> | ||
<Code slot="svelte" code={'<RangeSlider ariaLabels={["Volume"]} />'} lang="svelte" /> | ||
</Demo> | ||
|
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,29 @@ | ||
--- | ||
title: 'Examples' | ||
description: 'Examples of most of the options (props) available for the RangeSlider' | ||
--- | ||
import Info from '~components/Reusable/Info.astro' | ||
import RecipeList from '~/components/Reusable/RecipeList.astro'; | ||
import Recipe from '~/components/Reusable/Recipe.astro'; | ||
|
||
Use the links below to see examples of different options (props) available for the RangeSlider. | ||
|
||
|
||
|
||
<RecipeList> | ||
<Recipe name="Values & Binding" link="en/examples/values" /> | ||
<Recipe name="Min & Max" link="en/examples/min-max" /> | ||
<Recipe name="Pips" link="en/examples/pips" /> | ||
<Recipe name="Pip Labels" link="en/examples/pip-labels" /> | ||
<Recipe name="Steps" link="en/examples/steps" /> | ||
<Recipe name="Pip Steps" link="en/examples/pip-steps" /> | ||
<Recipe name="Steps & Pip Steps" link="en/examples/steps-combined" /> | ||
<Recipe name="Ranges" link="en/examples/range" /> | ||
<Recipe name="Pushy" link="en/examples/range#pushy-range-handles" /> | ||
<Recipe name="Float" link="en/examples/float" /> | ||
<Recipe name="Vertical" link="en/examples/vertical" /> | ||
<Recipe name="Prefix & Suffix" link="en/examples/prefix-suffix" /> | ||
<Recipe name="Formatter" link="en/examples/formatter" /> | ||
<Recipe name="Disabled" link="en/examples/disabled" /> | ||
<Recipe name="Easing" link="en/examples/easing" /> | ||
</RecipeList> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#a11y-slider { | ||
margin-block: 5rem!important; | ||
} |
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