w3c / accname

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

Testable statements using prohibited attribut/name #180

Open Jym77 opened 1 year ago

Jym77 commented 1 year ago

Several testable statements, e.g. Name test case 596 use pattern like:

if given
  <div id="test" aria-labelledby="ID1">foo</div>
  <span id="ID1">bar</span>
then the accessible name of the element with id of "test" is "bar"

However, with ARIA 1.2 and the current HTML AAM, div is mapped to generic role which prohibits name (and aria-label(ledby) attribute); in turn Step 1 of the name computation says to return the empty string on role that prohibit naming.

So, div#test actually has no name and the test breaks 😞 It seems replacing the div with a button would solve the problem in most (maybe all) these cases.

scottaohara commented 1 year ago

@jnurthen @accdc, we have been so focused on the ARIA spec clarifying that name prohibited is an author requirement (https://github.com/w3c/aria/issues/1487) and not presently a user agent requirement, that we seem to have missed these updates where in this spec name prohibited is implying that the element has no name. Rather, this likely should instead state "is not intended to be named" - or "may not return a name". Those wordings would better match reality and would better align with our current intent of limiting this to an author requirement, but not barring user agents from returning a name if authors name generics (boo).

Quickly, maybe the prohibited definition could change from

the element has no name.

to

the element is not meant to support naming a name.

and for step 1, either change:

If the root node's role prohibits naming, return the empty string ("").

to

If the root node's role prohibits naming, user agents MAY return the empty string ("").

or simply remove that particular text for now.