@@ -137,7 +137,7 @@ export const SliderThumb = React.forwardRef(function SliderThumb(
137
137
138
138
const direction = useDirection ( ) ;
139
139
const { setTouched, setFocused, validationMode } = useFieldRootContext ( ) ;
140
- const { commitValidation } = useFieldControlValidation ( ) ;
140
+ const { commitValidation, getValidationProps } = useFieldControlValidation ( ) ;
141
141
142
142
const thumbRef = React . useRef < HTMLElement > ( null ) ;
143
143
@@ -292,48 +292,53 @@ export const SliderThumb = React.forwardRef(function SliderThumb(
292
292
cssWritingMode = isRtl ? 'vertical-rl' : 'vertical-lr' ;
293
293
}
294
294
295
- const inputProps = mergeProps < 'input' > ( {
296
- 'aria-label' :
297
- typeof getAriaLabelProp === 'function' ? getAriaLabelProp ( index ) : elementProps [ 'aria-label' ] ,
298
- 'aria-labelledby' : labelId ,
299
- 'aria-orientation' : orientation ,
300
- 'aria-valuemax' : max ,
301
- 'aria-valuemin' : min ,
302
- 'aria-valuenow' : thumbValue ,
303
- 'aria-valuetext' :
304
- typeof getAriaValueTextProp === 'function'
305
- ? getAriaValueTextProp (
306
- formatNumber ( thumbValue , locale , formatOptionsRef . current ?? undefined ) ,
307
- thumbValue ,
308
- index ,
309
- )
310
- : elementProps [ 'aria-valuetext' ] ||
311
- getDefaultAriaValueText (
312
- sliderValues ,
313
- index ,
314
- formatOptionsRef . current ?? undefined ,
315
- locale ,
316
- ) ,
317
- [ SliderThumbDataAttributes . index as string ] : index ,
318
- disabled,
319
- id : inputId ,
320
- max,
321
- min,
322
- onChange ( event : React . ChangeEvent < HTMLInputElement > ) {
323
- handleInputChange ( event . target . valueAsNumber , index , event ) ;
324
- } ,
325
- step,
326
- style : {
327
- ...visuallyHidden ,
328
- // So that VoiceOver's focus indicator matches the thumb's dimensions
329
- width : '100%' ,
330
- height : '100%' ,
331
- writingMode : cssWritingMode ,
295
+ const inputProps = mergeProps < 'input' > (
296
+ {
297
+ 'aria-label' :
298
+ typeof getAriaLabelProp === 'function'
299
+ ? getAriaLabelProp ( index )
300
+ : elementProps [ 'aria-label' ] ,
301
+ 'aria-labelledby' : labelId ,
302
+ 'aria-orientation' : orientation ,
303
+ 'aria-valuemax' : max ,
304
+ 'aria-valuemin' : min ,
305
+ 'aria-valuenow' : thumbValue ,
306
+ 'aria-valuetext' :
307
+ typeof getAriaValueTextProp === 'function'
308
+ ? getAriaValueTextProp (
309
+ formatNumber ( thumbValue , locale , formatOptionsRef . current ?? undefined ) ,
310
+ thumbValue ,
311
+ index ,
312
+ )
313
+ : elementProps [ 'aria-valuetext' ] ||
314
+ getDefaultAriaValueText (
315
+ sliderValues ,
316
+ index ,
317
+ formatOptionsRef . current ?? undefined ,
318
+ locale ,
319
+ ) ,
320
+ [ SliderThumbDataAttributes . index as string ] : index ,
321
+ disabled,
322
+ id : inputId ,
323
+ max,
324
+ min,
325
+ onChange ( event : React . ChangeEvent < HTMLInputElement > ) {
326
+ handleInputChange ( event . target . valueAsNumber , index , event ) ;
327
+ } ,
328
+ step,
329
+ style : {
330
+ ...visuallyHidden ,
331
+ // So that VoiceOver's focus indicator matches the thumb's dimensions
332
+ width : '100%' ,
333
+ height : '100%' ,
334
+ writingMode : cssWritingMode ,
335
+ } ,
336
+ tabIndex : - 1 ,
337
+ type : 'range' ,
338
+ value : thumbValue ?? '' ,
332
339
} ,
333
- tabIndex : - 1 ,
334
- type : 'range' ,
335
- value : thumbValue ?? '' ,
336
- } ) ;
340
+ getValidationProps ,
341
+ ) ;
337
342
338
343
if ( typeof render === 'function' ) {
339
344
return render ( thumbProps , inputProps , state ) ;
0 commit comments