input-number icon indicating copy to clipboard operation
input-number copied to clipboard

Axe accessibility tool reports issue of role="spinbutton" div not having a label

Open emilyuhde opened this issue 7 years ago • 0 comments

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.

Screen Shot 2019-10-09 at 1 42 01 PM

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.

Screen Shot 2019-10-09 at 12 58 28 PM

Repro steps:

  1. Go to example usage of the input-number component
  2. 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.
  3. 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="spinbutton and all of the aria attributes off of this div and below to the input element which is the div's child (preferred)

emilyuhde avatar Oct 09 '19 17:10 emilyuhde