File tree 5 files changed +24
-19
lines changed
5 files changed +24
-19
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ " react-range " : minor
3
+ ---
4
+
5
+ Improving a11y of the slider by adding new label properties.
Original file line number Diff line number Diff line change @@ -17,17 +17,18 @@ const BasicVisibleLabelExample: React.FC<{ rtl: boolean }> = ({ rtl }) => {
17
17
flexWrap : "wrap" ,
18
18
} }
19
19
>
20
- < label
21
- onClick = { ( e ) => {
22
- rangeRef . current . thumbRefs [ 0 ] . current . focus ( )
23
- } }
24
- id = "unique_id"
25
- style = { {
26
- flex :"auto" ,
27
- fontFamily :"sans-serif"
28
- } }
29
-
30
- > Visible accessibility label:</ label >
20
+ < label
21
+ onClick = { ( e ) => {
22
+ rangeRef . current . thumbRefs [ 0 ] . current . focus ( ) ;
23
+ } }
24
+ id = "unique_id"
25
+ style = { {
26
+ flex : "auto" ,
27
+ fontFamily : "sans-serif" ,
28
+ } }
29
+ >
30
+ Visible accessibility label:
31
+ </ label >
31
32
32
33
< Range
33
34
labelledBy = "unique_id"
@@ -40,7 +41,6 @@ const BasicVisibleLabelExample: React.FC<{ rtl: boolean }> = ({ rtl }) => {
40
41
onChange = { ( values ) => setValues ( values ) }
41
42
renderTrack = { ( { props, children } ) => (
42
43
< div
43
-
44
44
onMouseDown = { props . onMouseDown }
45
45
onTouchStart = { props . onTouchStart }
46
46
style = { {
Original file line number Diff line number Diff line change @@ -704,8 +704,8 @@ class Range extends React.Component<IProps> {
704
704
"aria-valuenow" : value ,
705
705
draggable : false ,
706
706
ref : this . thumbRefs [ index ] ,
707
- "aria-label" : label ,
708
- "aria-labelledby" : labelledBy ,
707
+ "aria-label" : label ,
708
+ "aria-labelledby" : labelledBy ,
709
709
role : "slider" ,
710
710
onKeyDown : disabled ? voidFn : this . onKeyDown ,
711
711
onKeyUp : disabled ? voidFn : this . onKeyUp ,
Original file line number Diff line number Diff line change @@ -34,7 +34,7 @@ export const AnimatingContainer: React.FC<{ rtl: boolean }> = ({ rtl }) => (
34
34
export const Basic : React . FC < { rtl : boolean } > = ( { rtl } ) => (
35
35
< BasicExample rtl = { rtl } />
36
36
) ;
37
- export const BasicVisibleLabel : React . FC < { rtl : boolean } > = ( { rtl } ) => (
37
+ export const BasicVisibleLabel : React . FC < { rtl : boolean } > = ( { rtl } ) => (
38
38
< BasicVisibleLabelExample rtl = { rtl } />
39
39
) ;
40
40
export const BasicWithBorder : React . FC < { rtl : boolean } > = ( { rtl } ) => (
Original file line number Diff line number Diff line change @@ -9,8 +9,8 @@ export interface ITrackBackground {
9
9
rtl ?: boolean ;
10
10
}
11
11
export interface IProps {
12
- label : string ,
13
- labelledBy : string ,
12
+ label : string ;
13
+ labelledBy : string ;
14
14
values : number [ ] ;
15
15
min : number ;
16
16
max : number ;
@@ -50,8 +50,8 @@ export interface IThumbProps {
50
50
key : number ;
51
51
style : React . CSSProperties ;
52
52
tabIndex ?: number ;
53
- "aria-label" : string ,
54
- "aria-labelledby" : string ,
53
+ "aria-label" : string ;
54
+ "aria-labelledby" : string ;
55
55
"aria-valuemax" : number ;
56
56
"aria-valuemin" : number ;
57
57
"aria-valuenow" : number ;
You can’t perform that action at this time.
0 commit comments