Skip to content
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

[Popover] role="presentation" causing accessibility issue when Popover is open #18106

Closed
2 tasks done
emilyuhde opened this issue Oct 30, 2019 · 7 comments
Closed
2 tasks done
Labels

Comments

@emilyuhde
Copy link
Contributor

emilyuhde commented Oct 30, 2019

  • The issue is present in the latest release.
  • I have searched the issues of this repository and believe that this is not a duplicate.

Current Behavior 😯

When the Popover component is opened, the role is set to "presentation" which triggers a warning by HTML CodeSniffer that there is semantic meaning to elements under the element with role="presentation" so it's an inappropriate role to use.

"This element's role is "presentation" but contains child elements with semantic meaning."

Expected Behavior 🤔

The role used should not cause an accessibility error.

Steps to Reproduce 🕹

Steps:

  1. Open up the Popover demo page on the latest MUI site https://material-ui.com/components/popover/
  2. Click the "SHOW POPOVER" button to show the Popover in the first example, Simple Popover
  3. With the Popover open, run the HTML CodeSniffer tool https://squizlabs.github.io/HTML_CodeSniffer/

Context 🔦

When doing accessibility testing on my component that's using Popover as its base, this error was being reported by HTML CodeSniffer. I tracked it down to it being an issue with the underlying MUI component as well.

Your Environment 🌎

Tech Version
Material-UI v4.3.1 in my project
React 15.8.6
Browser Firefox, Chrome (should be all though)
TypeScript N/A

Screen Shot 2019-10-30 at 1 39 45 PM

@oliviertassinari
Copy link
Member

@emilyuhde I think that we should ignore what CodeSniffer thinks is right or wrong (tools can be wrong). Do you have reference materials we can look at to dive into the issue? Thanks

@eps1lon
Copy link
Member

eps1lon commented Dec 4, 2019

Thank you for opening this issue and filling out the template.

"This element's role is "presentation" but contains child elements with semantic meaning."

I was always suspicious of this usage since it's largely motivated by a lint rule that forbids event handlers on presentational generic elements. The rule itself is problematic since it assumes simple event handlers that don't have conditional logic. I'm not entirely sure how to construct an accessible backdrop that doesn't cause any false alarms.

What's important here is to find out if a presentational parent with non-presentational children is actually problematic for assistive technology. While these tools are helpful (like lint rules) while authoring content they can be deceiving when consuming libraries that validate particular usage.

@oliviertassinari
Copy link
Member

oliviertassinari commented Dec 4, 2019

In the unknown, I would tend to have more trust in a tool that has a look at the overall DOM output (CodeSniffer) rather than for a tool that performs static analysis (eslint). But, I think that it would be great to explore the problem deeper.

@eps1lon
Copy link
Member

eps1lon commented Dec 5, 2019

I did some research and it seems like that the role is intended to remove implicit semantics. Considering the eslint rule itself recommends disabling the rule instead of using presentation I'd say we follow that recommendation.

I'll do some testing with NVDA and Firefox if this introduces some false "clickable" announcement (something I really need to get clarification from NVDA folks).

@TrevorBurnham
Copy link

Per squizlabs/HTML_CodeSniffer#274, HTML Codesniffer has been updated so that it no longer complains about role="presentation" being set on an element like this.

@eps1lon
Copy link
Member

eps1lon commented Jan 13, 2020

Per squizlabs/HTML_CodeSniffer#274, HTML Codesniffer has been updated so that it no longer complains about role="presentation" being set on an element like this.

Thanks for the update.

I'm going to close this then. @emilyuhde Thank you for reporting this even though it turned out to be a false positive. Still valuable information to know which tools our users use and how they use them.

@danielweil
Copy link

This is still an issue. I can't find elements with React Testing Library on screen when Backdrop from multiple Select is opened.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants