input-number
input-number copied to clipboard
Axe accessibility tool reports issue of role="spinbutton" div not having a label
https://github.com/react-component/input-number/blob/d99e0346cf74eb5f9d0d6d0fd481885c9f535fa2/src/index.js#L776
Users are unable to pass in an aria attribute (such as aria-label) to this particular div where the role="spinbutton", and it is not being set in the component itself, so it is causing an accessibility issue.
I am able to use the component and add my own label (I'm wrapping and styling the component and adding the label in the below image) but this Axe reported issue still happens.
Repro steps:
- Go to example usage of the input-number component
- Make sure you have either the Axe browser extension installed and able to be run in your dev tools, or use the Storybook accessibility tool which uses Axe.
- Run the tool on the page that uses input-number
You will see a reported issue "Ensures every ARIA input field has an accessible name"
Potential fixes could be
- Allowing users to pass in an aria-label that is applied to this div
- Move the
role="spinbuttonand all of the aria attributes off of this div and below to theinputelement which is the div's child (preferred)