slider icon indicating copy to clipboard operation
slider copied to clipboard

rc-slider-handle raises issue with react-aXe accessibility checker

Open cameronthrntn opened this issue 4 years ago • 2 comments

A site operated by my workplace uses react-axe to check the accessibility of the site, and although seemingly a minor issue, react-axe flags the slider handle as non-accessible under: "ARIA input fields have an accessible name". I believe this issue would be recitifed by simply adding an aria-label to the element.

More info on this error can be found here: https://dequeuniversity.com/rules/axe/3.5/aria-input-field-name?application=axeAPI

cameronthrntn avatar Apr 06 '20 14:04 cameronthrntn

It looks like there are two props for labeling the handle, but they do not seem to work. ariaLabelledByForHandle and ariaLabelForHandle

I would love to make this slider fully accessible as well.

coreybrown89 avatar Jun 29 '20 19:06 coreybrown89

@Shubwub I was able to get the aria-label prop working by doing the following

import Slider, { Handle } from 'rc-slider';
<Slider
  // other slider props
  handle={({ value, ...restHandleProps }) => (
    <Handle value={value} {...restHandleProps} aria-label="your label here"/>
  )}
/>

coreybrown89 avatar Jun 29 '20 20:06 coreybrown89