Open dd8 opened 1 year ago
Yes, I think the generic
role needs to be skipped over by the rule, this matches its definition.
In Alfa, we map DOM nodes to either Element
or Container
accessibility nodes, depending whether they have semantics or are purely structural. My solution will thus be to map generic
DOM nodes to Container
and that should work the same way 🤞
But this indeed hints that the rule should skip over generic
elements (and/or that we need a definition of the accessibility tree or "owned by" that skip them).
agree that the generic role should be skipped by the rule. Even though they are "in the tree" does not mean it has any semantics to add to the tree.
I think the rule works as intended. The weird thing about "generic" is that whether or not it's in the accessibility tree is left up to the browser. So unlike "presentation" which is never in the AXT, or "list" which is always in the tree (unless hidden), whether or not an element with the "generic" role is in the tree is left up to the browser. Most browsers do basically the same thing they do with presentational role conflict; if the generic element is focusable, or has a global attribute its included in the tree, if not its ignored.
I;e; This passes the rule:<div role="menu"> <div> <div role="menuitem">
, but this fails it: <div role="menu"> <div tabindex="0"> <div role="menuitem">
Regardless, we should better explain this, and maybe have examples for it?
core-aam says role=generic should be exposed by a11y API: https://w3c.github.io/core-aam/#role-map-generic
Chrome and FF both expose <div>
as role=generic in the dev tools a11y tree if the element contains text nodes:
<!-- these appear in the a11y tree -->
<span>this is a span</span>
<div>this is a div</div>
<!-- these don't appear in the a11y tree -->
<span> </span>
<div> </div>
HTML-AAM | Chrome 120 | FF 120 | Safari 17 | |
---|---|---|---|---|
span | role=generic | StaticText no role | text leaf | role=AXStaticText |
div | role=generic | StaticText role=generic | role=generic | role=AXStaticText |
The ARIA required context role only considers parent/child relations in the accessibility tree https://www.w3.org/WAI/standards-guidelines/act/rules/ff89c9/proposed/
With ARIA 1.1 this means the following code passed the rule because the inner div, between list and listitem, had no implicit role and wasn't part of the ARIA tree:
Edit: in the ARIA 1.1 draft of AAM
div
was specified as:However HTML AAM was updated in https://github.com/w3c/html-aam/pull/348 to map div/span to the new ARIA 1.2 generic role.
That means both these lists produce an identical ARIA tree and both now fail the rule:
There will be a lot of pages using divs/spans without roles that passed previously - including many of the ARIA patterns at https://www.w3.org/WAI/ARIA/apg/patterns/.
These haven't suddenly become less accessible - so I think the rule needs to change.
This is related to https://github.com/act-rules/act-rules.github.io/issues/1985 and https://github.com/act-rules/act-rules.github.io/issues/1990