zillow / react-slider

Accessible, CSS agnostic, slider component for React.
https://zillow.github.io/react-slider
MIT License
891 stars 232 forks source link

Support for aria-label #124

Closed atlidohop closed 6 years ago

atlidohop commented 6 years ago

It would be nice if it were possible to pass some aria-* props to the component, e.g.:

<ReactSlider
  value={[minValue, maxValue]}
  ...
  ariaLabel={["Some description, lower bound", "Some description, upper bound"]}
  ariaValuetext={/* Some code to format the value text nicely */}
/>

I've made some changes in react-slider.js to make this work for my use case. I simply add these attributes after line 750 in _renderHandle():

'aria-label':
  this.props.ariaLabel && i < this.props.ariaLabel.length ? this.props.ariaLabel[i] : '',
'aria-valuetext': this.props.ariaValuetext ? this.props.ariaValuetext : '',

Should I open up a PR with these changes? Do I need to consider anything else, like updating the README.md or the examples?