Vertical Temperature Slider Example
WARNING! Some users of touch-based assistive technologies may experience difficulty utilizing widgets that implement this slider pattern because the gestures their assistive technology provides for operating sliders may not yet generate the necessary output. To change the slider value, touch-based assistive technologies need to respond to user gestures for increasing and decreasing the value by synthesizing key events. This is a new convention that may not be fully implemented by some assistive technologies. Authors should fully test slider widgets using assistive technologies on devices where touch is a primary input mechanism before considering incorporation into production systems.
The following example is a vertically oriented temperature control that implements the
slider 설계 패턴.
The slider illustrates use of aria-orientation
to specify vertical orientation and use of aria-valuetext
to convey unit of measure for numeric values to assistive technology users by appending degrees Celsius
to the current value.
유사한 예는 다음과 같습니다:
- Color Viewer Slider Example: Basic horizontal sliders that illustrate setting numeric values for a color picker.
- Rating Slider Example: Horizontal slider that demonstrates using
aria-valuetext
to communicate current and maximum value of a rating input for a five star rating scale. - Media Seek Slider Example: Horizontal slider that demonstrates using
aria-valuetext
to communicate current and maximum values of time in media to make the values easy to understand for assistive technology users by converting the total number of seconds to minutes and seconds. - Horizontal Multi-Thumb Slider Example: Demonstrates using sliders with two thumbs to provide inputs for numeric ranges, such as for searching in a price range.
Example
접근성 특성
- The display of the slider's current value remains adjacent to the thumb as the thumb is moved, so people with a small field of view (e.g., due to magnification) can easily see the value while focusing on the thumb as they move it.
-
To ensure the borders of the slider rail, thumb and focus ring have sufficient contrast with the background when high contrast settings invert colors, the color of the borders are synchronized with the color of the text content.
For example, the color of the focus ring border is set to match the foreground color of high contrast mode text by specifying the CSS
currentcolor
value for thestroke
property of the inline SVGrect
element used to draw the focus ring border. To make the background of therect
match the high contrast background color, thefill-opacity
attribute of therect
is set to zero. If specific colors were instead used to specify thestroke
andfill
properties, those colors would remain the same in high contrast mode, which could lead to insufficient contrast between the rail and the thumb or even make them invisible if their color matched the high contrast mode background.
Note: The SVG element needs to have the CSSforced-color-adjust
property set toauto
for thecurrentcolor
value to be updated in high contrast mode. Some browsers do not useauto
for the default value.
키보드 지원
키 | 기능 |
---|---|
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 twenty steps (e.g. 2°C). |
Page Down | Decreases temperature slider value multiple steps. In this slider, jumps twenty steps (e.g. 2°C). |
Home | Sets slider to its minimum value. |
End | Sets slider to its maximum value. |
Role, Property, State, Tabindex 어트리뷰트
역할(role) | 어트리뷰트 | 엘리먼트 | 사용법 |
---|---|---|---|
none
|
svg
|
ensures assistive technologies do not present the SVG element as an image or any other type of meaningful element. | |
slider
|
g
|
|
|
tabindex="0"
|
g
|
Includes the slider thumb in the page tab sequence. | |
aria-orientation
|
g
|
Indicates the slider is vertically oriented. | |
aria-valuemax="NUMBER"
|
g
|
Specifies the numeric value that is the maximum allowed value of the slider. | |
aria-valuemin="NUMBER"
|
g
|
Specifies the numeric value that is the minimum allowed value of the slider. | |
aria-valuenow="NUMBER"
|
g
|
A numeric value that is the current value of the slider. | |
aria-valuetext="STRING"
|
g
|
Provides a more user-friendly name for the current value of the slider by combining the current value with the string degrees Celsius. |
|
aria-labelledby="IDREF"
|
g
|
Refers to the element containing the name (e.g. label) of the slider. | |
aria-hidden="true"
|
rect
|
Removes the SVG rect element from the accessibility tree to prevent screen readers from presenting it as a meaningful image. |
Javascript와 CSS 소스 코드
- CSS: slider-temperature.css
- Javascript: slider-temperature.js
HTML Source Code