Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Fix documentation #510 #522
left a comment
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
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: #510 (comment)
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.