w3c / core-aam

Core Accessibility API Mappings
https://w3c.github.io/core-aam/
39 stars 10 forks source link

audit rule for role="none" and role="presentation" on <table> and <ul> #222

Open spectranaut opened 9 months ago

spectranaut commented 9 months ago

We have some special logic for handling role="none" on elements which have allowed accessible children: https://w3c.github.io/core-aam/#role-map-none

For ATK/ATSPI says:

For objects that have specified allowed accessibility children (e.g., a grid with gridcell children, a list with listitem children), and the descendant is in the accessibility tree, expose it as ROLE_SECTION. user agents SHOULD prune empty descendants from the accessibility tree.

Does this mean, that given the following html:

<ul role=none>
  <li>list item one</li>
  <li>list item two</li>
</ul>

The ul in this case should be mapped to an element with ROLE_SECTION? When testing right now (in chome on linux), it is pruned.

There is a core-aam test for this, but the test tests the child li element -- I guess that it is testing the children because the the ul is expected to be pruned: https://github.com/web-platform-tests/wpt/blob/master/core-aam/presentation_used_on_ul_element_with_li_children-manual.html

I'll test on the other platforms later.

smhigley commented 9 months ago

I think the tests on the child li elements are correct -- based on that (rather ambiguous) wording, I think it's describing the following behavior and expected output:

<ul role=none>
  <li>list item one</li>
  <li>list item two</li>
  <li></li> <!-- empty child -->
</ul>

output tree for ATK/SPI:

- (ignored)
   - ROLE_SECTION
   - ROLE_SECTION

Does that look right to you? I believe the "it" in expose it as ROLE_SECTION is referring to the child and not the parent.

That said, I've noticed AX API has the following inconsistency: Core AAM says to map "it" to AXGroup, but the <ul role=none> is pruned and the <li> elements are exposed as AXStaticText

UIA's description appears to match the mapping -- both ul and all li elements are pruned, and the content of the li elements are exposed as Text nodes.

I wasn't able to test IA2 or ATK/AT-SPI -- those also seem worth checking whether they match what's in Core AAM.