react-component / react-component/input-number

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

Open
#201 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
323
Forks
188
Avg merge
20h 3m
Merged PRs (30d)
1

Description

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)

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at src/index.js around line 776 and reproduce the report using the example usage with the Axe browser extension or Storybook accessibility tool. Trace the role="spinbutton" div and its child input, then verify the chosen accessibility change removes the "Ensures every ARIA input field has an accessible name" report.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
accessibility, frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.