Skip to content
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

Why is aria-required on input with type="range" a critical issue? #4027

Closed
cstrobbe opened this issue May 22, 2023 · 4 comments · Fixed by #4035
Closed

Why is aria-required on input with type="range" a critical issue? #4027

cstrobbe opened this issue May 22, 2023 · 4 comments · Fixed by #4035
Labels
fix Bug fixes rules Issue or false result from an axe-core rule

Comments

@cstrobbe
Copy link

cstrobbe commented May 22, 2023

Product

axe-core

Question

When an input element has type="range" (i.e. a slider input), the presence of the attribute aria-required="true" triggers the Axe rule Elements must only use allowed ARIA attributes. This rule has the impact level "Critical" (the highest level), i.e. "Results in blocked content for people with disabilities, and will definitely prevent them from accessing fundamental features or content."

I understand that incorrect roles can be blocking in certain cases, but why would aria-required="true" be blocking on a slider / range input? I also understand that marking a slider input as required makes little sense, since the input always has a default value, even without user interaction. In fact, the HTML 5 specification even prohibits the native attribute required on a slider. But that still does not explain why aria-required="true" would be a blocking issue on a range input.

Is this really a blocking issue or does the rule "Elements must only use allowed ARIA attributes" catch too many things?

@cstrobbe cstrobbe added question ungroomed Ticket needs a maintainer to prioritize and label labels May 22, 2023
@mikeybinns
Copy link
Contributor

I'm also getting a similar issue with <button role="switch" aria-required="true" /> which is an allowed option as per the spec https://w3c.github.io/aria/#switch

@straker
Copy link
Contributor

straker commented May 22, 2023

Thanks for the issue. It looks like the slider role does not allow aria-required (slider being the implicit role of a range input), but the switch role does. So axe-core is correct according to spec for the OP, but incorrect for the followup comment.

We'd love a pr for the role=switch issue. You'd just have to update the aria-roles file for the switch role to add aria-required to the list of allowedRoles, then update the aria-allowed-attrs integration file to add aria-required to the role=switch element.

@straker straker added fix Bug fixes rules Issue or false result from an axe-core rule and removed question ungroomed Ticket needs a maintainer to prioritize and label labels May 22, 2023
@straker
Copy link
Contributor

straker commented May 23, 2023

Talked to @WilcoFiers about slider not allowing aria-required. We decided that even if the spec doesn't allow it axe-core should since it won't cause any problems for screen readers or users. We'll also make sure other input type roles do the same since having code that generates the type dynamically can easily generate this problem.

@padmavemulapati
Copy link

padmavemulapati commented May 25, 2023

Verified with the latest axe-core-develop branch code base,

<input type="range" aria-required="true" /> is not failing for aria-required-attr

Screen.Recording.2023-05-25.at.2.14.37.PM.mov

For role=switch - <button role="switch" aria-required="true" /> will fail for aria-required-attr
but pass when aria-checked is there .

Uploading Screen Recording 2023-05-25 at 8.31.05 PM.mov…

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fix Bug fixes rules Issue or false result from an axe-core rule
Projects
None yet
4 participants