-
-
Notifications
You must be signed in to change notification settings - Fork 627
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
Rule proposal: require clickable non-button/non-link elements listen for space or enter #77
Comments
Btw I think also inputs work as well - essentially form elements and links should have that behavior default. It's the elements that you're adding non default behavior to where you have to also add in keyboard listeners |
Oh right, of course. |
For purposes of semantic markup, why would we want to encourage adding |
Yeah, it should likely suggest using a button or link first, or alternatively adding the keyboard stuff. |
Do we have another rule that can actively prohibit adding interaction behavior to non-natively-interactable DOM elements? |
No but we have onclick-has-role, which requires adding the just to clarify, this seems like we are taking the logic for determining non-interactive DOM elements from rule: |
If you are making a non-button or non-link element clickable, you also need to wire up keyboard listeners for space and enter. While I don't think we will be able to ensure that this is all implemented correctly, we can likely at least add a warning for any DOM element that is not
a
orbutton
that hasonClick
and not a keyboard event listener.cc @backwardok
The text was updated successfully, but these errors were encountered: