Skip to content

no-redundant-roles ignores type number in input #686

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
andre-matulionis-ifood opened this issue May 14, 2020 · 1 comment
Open

no-redundant-roles ignores type number in input #686

andre-matulionis-ifood opened this issue May 14, 2020 · 1 comment
Assignees
Labels

Comments

@andre-matulionis-ifood
Copy link

Sandbox reproducing: https://codesandbox.io/s/jsx-a11y-no-redundant-role-p6ojt?file=/src/App.js

For a <input type="number"/> in the HTML, the implicit role of it is spinbutton. This happens both in Chrome 81 (image) and Firefox 76.

the print of the words "role spinbutton"

So it can be concluded that in <input type="number" role="textbox" /> the role attribute is not redundant, since it modifies the implicit role of the HTML. However the rule no-redundant-roles does not consider this.

"The element input has an implicit role of textbox. Defining this explicitly is redundant and should be avoided"

@jessebeach
Copy link
Collaborator

jessebeach commented Jun 20, 2020

@andre-matulionis-ifood it's worse than that. The semantics change to textbox in the AX Tree, but the UX in the browser remains a spinbutton. I think you discovered a new category of how to abuse HTML input semantics :) There will be some cases that are OK, like upgrading a textbox to a combobox, but cases like the one you point out where the semantics and UX are incompatible.

A_Pen_by_J__Renée_Beach

Let's make this a new rule issue instead of a bug.

@jessebeach jessebeach added new-rule and removed bug labels Jun 20, 2020
lb- added a commit to lb-/eslint-plugin-jsx-a11y that referenced this issue Oct 23, 2024
Adopt the latest ARIA standards (1.2) for input elements' implicit roles.

- Add support for input type="number" with implicit role "spinbutton"
- Add better support for `input` types including checks for when list attribute is used
- Correctly set role of search input type to searchbox (or combobox for list)
- Ensure that input types with no corresponding role are correctly catered for & tested

See https://www.w3.org/TR/html-aria/#el-input-text-list
See https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#technical_summary

Fixes jsx-eslint#686
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants