-
-
Notifications
You must be signed in to change notification settings - Fork 636
Description of role="presentation" in docs is misleading #510
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
Comments
@TrevorBurnham, thank you for the thoughts. I share your concerns about the escape hatch. I've observed some bad patterns emerge at FB as well. This issue is definitely on my mind. |
@TrevorBurnham still thinking on this. I acknowledge the potential for confusion. But we have a fundamental challenge with this linter. The only way it works is if we are very strict with semantics. And one semantic distinction in HTML that isn't formally established is application-HTML vs interface-HTML. In your example, you are conflating the two:
A What a developer should instead do is introduce Application Boundaries (just like Error Boundaries) into their app, yielding something like:
So that the Application and UI are clearly distinct. I'd prefer to recommend an approach like this in the documentation. |
I can't get on board with a flag like
Good to bring this up. I don't quite understand what you intend with this comment, but there's an important point in the comment that should make it into the documentation as well. If you're thinking it, so are other developers. Might I trouble you for an elaboration? |
Let me step back for a moment, because you're right that the
By contrast, the code for the rule says:
I think the code is right: Setting I'd phrase the section of the documentation something like this:
|
@TrevorBurnham that's a totally fair and good way of putting it. I agree with your updated documentation. If you put that in the PR, we can merge it in. |
Would it make sense to reject role="presentation" or role="none presentation" with interactive handlers? We used the old recommendation which seems to have quite the negative impact. That way users are automatically notified that the recommended workaround changed. "rewrite bubble events section" does not indicate that the old behavior was wrong. Happy to work on on this but I'd like to know what @TrevorBurnham thinks. |
🤔 I'm just now seeing the subsequent change to the recommendation in the docs (#522). When you say "We used the old recommendation which seems to have quite the negative impact," do you mean that setting |
We're maintaining a component library and have limited capabilities for testing assistive technology. I could not find any issues with NVDA + firefox but from the documentation of the rule it seems that others might. We basically used the click handler on a backdrop which could own a dialog or popover menu. I'm a bit surprised that the only issue report we got was due to a third party testing tool and not actual assistive technology (mui/material-ui#18106). I read https://www.w3.org/TR/wai-aria-practices-1.1/#presentation_role_effects again and it seems like the role usage is safe on generic containers such as |
Looking at that issue, I'm pretty sure that report is a false positive from HTML CodeSniffer. The spec you linked to specifically says that when you set
|
I've filed an issue on the CodeSniffer side: squizlabs/HTML_CodeSniffer#274 |
Per discussion on that issue, the CodeSniffer folks agreed that it's a false positive and have fixed their detection logic. |
@TrevorBurnham great research and follow-through on this one. Thank you so much!!!! |
The no-static-element-interactions docs currently state:
Case: This element is not a button, link, menuitem, etc. It is catching bubbled events from elements that it contains
If your element is catching bubbled click or key events from descendant elements, then the proper role for this element is
presentation
.Marking an element with the role
presentation
indicates to assistive technology that this element should be ignored; it exists to support the web application and is not meant for humans to interact with directly.There are a couple of things wrong with this:
The example implies that a
div
element should haverole="presentation"
. But settingrole="presentation"
on adiv
is redundant. The definition ofrole="presentation"
in WAI-ARIA 1.1 is:Elements like
div
andspan
have no implicit native role semantics in the first place. See Example 8 in that section for further clarification.The paragraph after the example suggests that assistive technology ignores elements with
role="presentation"
entirely, which has never been the case. In fact, this is a common misconception. Per the note in that same section WAI-ARIA 1.1:You might rewrite the section to explain that the rule is prone to false positives, and that
role="presentation"
is just an escape hatch to make the linter ignore a particular element. However, that advice could lead to unintended consequences. For example, consider the case where someone is using aul
element to handle events that bubble up from its descendants:Adding
role="presentation"
to theul
element would remove the list semantics.So I think you should consider adding a different escape hatch for the event bubble case. There's no appropriate ARIA attribute, because such an element doesn't need any special handling from assistive technology. Maybe you could check for an attribute called something like
data-only-handles-propagated-events
. 🤷♂️The text was updated successfully, but these errors were encountered: