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

Have commons consider presentational children #2213

Open
WilcoFiers opened this issue May 6, 2020 · 3 comments
Open

Have commons consider presentational children #2213

WilcoFiers opened this issue May 6, 2020 · 3 comments
Labels
commons Issues in the common code (lib/commons) feat New feature or enhancement rules Issue or false result from an axe-core rule

Comments

@WilcoFiers
Copy link
Contributor

WAI-ARIA has a section on presentational children:

https://www.w3.org/TR/wai-aria-1.1/#childrenArePresentational
The DOM descendants are presentational. User agents SHOULD NOT expose descendants of this element through the platform accessibility API. If user agents do not hide the descendant nodes, some information may be read twice.

Basically, if you do this:

<div role="img">
  <button>Hello</button>
</div>

What you get in the accessibility tree is just an img. That button does not exist. Because it is still focusable, there is now an element in focus navigation without a corresponding node in the accessibility tree. That explains the root cause of #601, and expands it a little, because it isn't exactly nested elements, it's focusable content inside of elements with "Presentational children: true" in ARIA. That "nested interactive elements" rule is actually very similar to the aria-hidden-focusable rule, except that the reason the focusable element is removed is a different one.

Axe-core does not take this into account anywhere; and there are quite a few places where it probably should. Ones that come to mind are:

  • accessibleText()
  • getRole()
  • isVisible()

Since we've never had anyone report on this, I imagine this doesn't happen much in practice (I sure hope not). But it's probably worth considering anyway, and maybe to do some testing with different AT to figure out how consistent this behaviour is.

@WilcoFiers WilcoFiers added feat New feature or enhancement rules Issue or false result from an axe-core rule commons Issues in the common code (lib/commons) labels May 6, 2020
@Malvoz
Copy link
Contributor

Malvoz commented Aug 3, 2020

I imagine this doesn't happen much in practice (I sure hope not)

w3c/html-aam#292 describes one such case.

@straker
Copy link
Contributor

straker commented Jun 17, 2021

@WilcoFiers this now gets flagged by the nested-interactive rule as a violation due to the img element having focusable children. Is there anything else we should do for this issue?

@WilcoFiers
Copy link
Contributor Author

My thinking on this has changed, now that I've learned browsers are inconsistent about this particular piece in ARIA. Some browsers will put them in presentation and others will not. Since axe-core can only test one of those scenarios, I think the one that will get us the best results is to not apply the presentational children logic. Take the img > button example from above. We'll probably want to flag an issue if either one of those two elements doesn't have a name. So I think keeping it "as is" is probably best.

That said - that seems like a good default. It might be nice to make this optional. If you're just interested in Safari, applying presentational children is the right thing to do. I think we should keep it open. I have for a long time wanted us to have a more configurable engine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
commons Issues in the common code (lib/commons) feat New feature or enhancement rules Issue or false result from an axe-core rule
Projects
None yet
Development

No branches or pull requests

3 participants