w3c / accname

Accessible Name and Description Computation
https://w3c.github.io/accname/
61 stars 23 forks source link

Step F "if the current node's role allows name from content" should only apply to the root node #120

Open JAWS-test opened 3 years ago

JAWS-test commented 3 years ago

If the rule always applies, the result is that nested elements that can only be labeled by the author, but do not require a label, will not pass a label to the ancestor element if they are not explicitly labeled, and thus are empty.

This applies to the following ARIA roles, among others:

<a href=...><blockquote>quote</blockquote></a>

would thus lead to an unlabeled link. This is not only a theoretical problem, but actually leads in Chrome and Firefox always to an unlabeled link, which is accordingly also output by the screen reader without a label (in JAWS for some ARIA roles always, for others only if the link has e.g. a title attribute)

Even if these elements are explicitly labeled, it is worth checking whether the label or rather the text content should be transmitted:

<a href=...><ul aria-label=list><li>item 1<li>item 2</ul></a> <a href=...><article aria-label=article>content</article></a>

According to the current rule, the aria-label is output as a link label. The question is whether it doesn't make more sense to output the text content. The problem is that screen readers no longer output the text content even when reading linearly. However, browsers and screen readers interpret the rule differently. For example, the text content is not output at all for an article, but it is output for a list.

It should also be noted that screen readers often automatically use the text content as a label if no explicit label is available, e.g. for lists and tables (but only in the element overview).

And how can I identify if HTML elements support name from content? For ARIA roles it's in the specification, but not for HTML elements...

Related: https://github.com/w3c/accname/discussions/113, https://github.com/w3c/accname/discussions/118 and https://github.com/w3c/aria/issues/899

JAWS-test commented 3 years ago

There are also ARIA roles that cannot be labeled at all. If these are e.g. in a link, then the link has no label according to specification, e.g.

<a href=...><span role=presentation>text content</span></a>

However, the problem occurs only in the specification, the browsers ignore the error in the specification and use the text content as a label (unlike with the ARIA roles that have Name from Author, see above)