Add language regarding handling author errors (missing name, name prohibited)
(This right now is a tracking issue, pending resolution of some related ARIA-spec issues.)
ARIA 1.2 introduced the concept (with associated normative statements) of name-prohibition. See https://www.w3.org/TR/wai-aria-1.2/#namecalculation.
Concerns have since been raised about name prohibition. See, for instance:
- https://github.com/w3c/aria/issues/1476
- https://github.com/w3c/aria/issues/1487
We're still waiting for full resolution to the above, but at the very least we're going to allow user agents to give names as a repair mechanism even though names are prohibited. For instance, the one thing that would make
<div tabindex="0" aria-label="foo"></div>
even less accessible is if "foo" were not exposed as the name, resulting in screen readers potentially saying nothing when that element got focus.
There is a chance, however, that we're going to make name prohibition strictly an author error and not have normative expectations for user agents. See the second of the above issues.
AccName currently says:
- Set the root node to the given element, the current node to the root node, and the total accumulated text to the empty string (""). If the root node's role prohibits naming, return the empty string ("").
In light of the discussions in the above ARIA issues, we may need to remove that sentence.
Related: Let's say we remove the statement from step 1 and tweak the test case:
<div tabindex="0">foo</div>
We'll hit step 2F with a generic which does not support name from contents. 2G doesn't apply because it's not a text node. 2H doesn't because it's not a descendant; it's the root node. 2I doesn't because there's no tooltip. Technically this has no name. But we don't want screen readers to say nothing when this element gets focus.
If the ARIA spec adds language in its handling author errors section (e.g. interactive generics support name from contents as a repair mechanism), then we can just point to that.
Also related: Let's say we address everything above and we get to step 2F with a focusable generic for which name from contents is officially allowed as a repair. And let's say that focusable generic has a TON of content -- far more than is suitable for an accessible name. We want an interoperable experience so perhaps we should prescribe something?
- Only expose the first child element as the name? OR
- Look for a heading and expose the first heading as the name? OR
- Expose the first n words as the name? OR
- Something else?
See also: https://bugs.chromium.org/p/chromium/issues/detail?id=1216867
See also https://github.com/w3c/aria/issues/899