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
Fix documentation #510 #522
Fix documentation #510 #522
Conversation
Fixes #510 : removed mention of the role attribute. Suggestion for fixing the error with a comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I disagree with the recommendation. I would rather expand it and provide more examples. This rule is catching a pattern that can lead to ambiguous semantics. It's unfortunate that the value of role is presentation
. I think the confusion would be reduced if the value we used were none
. But we have the token we have.
I would rather that the documentation move in the direction of encouraging developers to separate their Application Structures from the User Interface. Putting click-handlers on elements that have non-interactive or static semantics is just a bad code smell and a habit that will most certainly lead to inaccessible interfaces: https://github.com/evcohen/eslint-plugin-jsx-a11y/issues/510#issuecomment-452923532
Role=none does not exist in the ARIA specification. You are suggesting using ARIA roles to fix a false positive in a linting tool, and the example in the current documentation leads to accessibility issues : it is the reason I took the time to make modifications to the documentation. There are at least two legitimate use cases I encountered in my job for using a event handler on a static element: I will provide them quickly.
|
First example: With the ARIA combobox design pattern, there are two subcomponents: the textbox, and the listbox component. Keyboard interactions are managed on the textbox, but mouse interactions are managed on the listbox. If you add a wrapper Second example: you want to make a whole Putting event handlers on static elements is not a code smell, from my point of view, given the above examples. Putting useless Regarding the Application Structure suggestion, I have a question: such a component would not trigger the rule, but still allow to create code that will not follow the rule: am I correct on this? I understand that is a limitation of static code analysis, but I am a bit uneasy with suggesting ways around the rule that will create the problematic code, without any warning from the linter. My opinion is that disabling the rule in this case is much more explicit of the developer's intentions. |
@n-chardon you convinced me. Please update the PR and I'll merge it. Thank you for taking the time to explain your reasoning. |
@jessebeach thanks for taking the time to read me. I have updated the PR, please let me know if there is anything else to do on my side. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In case you ran prettier on this, be aware that it’s markdown formatter is significantly worse (sometimes) than its js one.
@n-chardon as @ljharb mentioned, please propose the changes without the formatting changes. Sorry for the churn! |
@ljharb eveything is up to date, and hopefully, much cleaner. |
@n-chardon thanks; I rebased it again and reverted a few more unrelated formatting changes. @jessebeach i think this is ready for your review again :-) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good to go. The test failures are unrelated to these changes (at least, I cannot see any connection that is sane or obvious.).
I updated ESLint to the latest version locally on master and started getting the same errors as the Travis run. We'll get this committed once I get the ESLint issue sorted, which may be in a week because I go on vacation in 2 days I won't be looking at a computer for a week :) |
@n-chardon 👋 I'm just now seeing this. Re:
My understanding is that <div role="presentation">
<button>Click me</button>
</div> the computed role for the button is |
@TrevorBurnham you are right: in your example, the button will still be exposed as a button. However, I remember encountering an issue where |
Fixes #510
Removed mention of the role attribute. Suggestion for fixing the error by disabling the rule for the element.