Slider Examples with aria-orientation and aria-valuetext
The following example of a hypothetical online thermostat demonstrates the
slider design pattern.
The desired temperature is set with the first slider, which is vertically oriented.
Two horizontal sliders set fan speed and mode.
The horizontal sliders illustrate how to use aria-valuetext
to provide assistive technologies with meaningful names for numeric values.
Similar examples include:
- Horizontal Slider Examples: Demonstrates using three horizontally aligned sliders to make a color picker.
Example
Keyboard Support
Key | Function |
---|---|
Right Arrow | Increases slider value one step. |
Up Arrow | Increases slider value one step. |
Left Arrow | Decreases slider value one step. |
Down Arrow | Decreases slider value one step. |
Page Up | Increases temperature slider value multiple steps. In this slider, jumps ten steps. |
Page Down | Decreases temperature slider value multiple steps. In this slider, jumps ten steps. |
Home | Sets slider to its minimum value. |
End | Sets slider to its maximum value. |
Role, Property, State, and Tabindex Attributes
Role | Attribute | Element | Usage |
---|---|---|---|
slider
|
div
|
|
|
tabindex=
|
div
|
Includes the slider thumb in the page tab sequence. | |
aria-orientation
|
div
|
|
|
aria-valuemax=
|
div
|
Specifies a numeric value that is the maximum value the slider can have. | |
aria-valuemin=
|
div
|
Specifies a numeric value that is the minimum value the slider can have. | |
aria-valuenow=
|
div
|
A numeric value that is the current value of the slider. | |
aria-valuetext=
|
div
|
|
|
aria-labelledby=
|
div
|
Refers to the element containing the name of the slider. |
Javascript and CSS Source Code
- CSS: text-slider.css
- CSS: vertical-slider.css
- Javascript: text-slider.js
- Javascript: vertical-slider.js
HTML Source Code