Closed jaragunde closed 3 years ago
Seems reasonable to special case aria-label
.
What would you expect to happen in the case of an empty aria-label
, rather than a missing attribute? Would this step result in "" or "contents"?
<span hidden id="foo" aria-label="">contents</span>
Update: I discussed with @accdc. There is already precedent for ignoring empty aria-label, so this step should return the "contents" innerText.
Something like this?
-<li>If the <code>current node</code> is <a class="termref">hidden</a>, compute the text alternative of the <code>current node</code> by returning {{HTMLElement/innerText}} of the node.</li>
+<li>If the <code>current node</code> is <a class="termref">hidden</a>:
+ <ol>
+ <li>If the <code>current node</code> has an <a class="pref">aria-label</a> attribute whose value, when trimmed of white space, is not the empty string, return the value of <a class="pref">aria-label</a>.</li>
+ <li>Otherwise, compute the text alternative of the <code>current node</code> by returning the {{HTMLElement/innerText}} of the node.</li>
+ </ol>
+</li>
@cookiecrook +1
This will reduce the chances that we will break existing content, and is reasonably simple and intuitive.
Assuming @jaragunde and @accdc will like this change, so I've added it as a change suggestion to PR #137. Once the change is pulled in there, this issue #144 can be closed.
Closing since that's now part of #137. Re-open if needed. Thanks @jaragunde and @aleventhal.
Thanks to you for shaping this suggestion into the proposed text!
I'm reporting a case that I came up when implementing the proposal in PR #137, related to the discussion in #57, in Chromium.
When the hidden element which is a target of an aria-labelledby relation has the aria-label property, it might be preferable to use that instead of innerText. An example, based on an existing Chromium test:
The name of the node with id="test" used to be 'span-A4', but after implementing the PR #137 proposal, the name is empty.