Repository navigation
a11y: Warn when using native disabled on a button
#12961
Closed
jmuzina
started this conversation in
Rule suggestion
Replies: 4 comments 5 replies
|
Hey, thanks for the suggestion. Is there existing research around this topic ? Would love to see if there some sort of consensus around this way of doing things. Also doesn't this assume JS is used ? I could imagine someone not using JS at all, so they wouldn't be able to disable the clicks. |
5 replies
|
Just wanted to say thank you for getting on this so quickly. I'm blind and a screen reader user and this does actually make a big difference! |
0 replies
|
That would be great! |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
I would like to propose a new accessibility rule that warns developers when they use the native
disabledattribute on interactive elements like<button>, encouraging the use ofaria-disabled="true"instead, while allowing for an escape-hatch to ignore the warning in cases where the native disabled attribute is necessary.Rationale
disabledcompletely removes an element from the browser's focus order and hides it from screen readers. This creates a poor experience for keyboard and screen reader users. In many cases,aria-disabledshould be used (along with using JS to ignore button clicks / form submissions), to keep the button perceptible to screen reader users.Valid Use Cases for native
disabledThere are valid cases for the native
disabledattribute, such as disabling an entire collection of form fields (e.g., a<fieldset>for a spouse-specific form section when you have indicated you have no spouse in a previous input.)Because of this nuance, I suggest that this be a
warn, rather than anerror. The idea here is that this rule would introduce "development friction" so devs are prompted to verify if they are mistakenly hiding an interactive element that users should be aware of when disabled If they genuinely need it, they could use// biome-ignorecomment to accept the risk.Fail Cases
Pass Cases
All reactions