Re: Regarding the accessible name calculation for aria-label within links?

Hi,

On 2014-Feb-13 7:33 AM, James Teh wrote:
> ... The question that doesn't seem to be covered explicitly by the 
> spec as far as I can see (and I'm very happy to be informed otherwise) 
> is when aria-label(ledby) should completely override the content ...

I had to go and look.  Here is what the spec says:

1.  Each role has a characteristics table that contains a "Name From:" 
entry.  The possible values are "author", "contents", or both.  For 
example, the alert role's namefrom is "author", whereas the link role 
has namefrom "contents" or "author".  A quick scan through all of the 
roles shows that many support namefrom author only, some support 
namefrom author or contents, but none have namefrom contents only.

2.  There is a statement regarding namefrom at the beginning of the 
accessible name calculation (Section 5.2.7 [1]) .  In brief, if the role 
permits namefrom author or contents, and the author has specified the 
name using, say, aria-label, then that has precedence over namefrom 
contents.

3.  Steps 1, 2A, and 2B of the text alternative calculation all deal 
with namefrom author scenarios.  Beginning with step 2C, if there is no 
author supplied name, then, "... text is collected from descendant 
content if the current element's role allows 'Name From: contents.'"

4.  If the computation is using rule 2C to concatenate content from an 
element's descendants, and one of the descendant elements has an 
aria-label attribute, then its contribution is the value of its 
aria-label attribute, not its contents.  For example:

<span role="listitem">What is my <a href="#" aria-label="name">nom de 
plume</a>?</span>

The name of the list item is "What is my name?".  Here's why:  The list 
item role allows namefrom contents or author, but the author has not 
supplied one.  Thus, proceed by gathering text content from the list 
item's descendants.  We get as far as "What is my" when a link child is 
encountered with an aria-label.  For the link, switch to namefrom author 
and add "name" to the result.  After the link, switch back to namefrom 
content and add the question mark.  Fini.

To be complete, if the author did not add an aria-label on the link, the 
name of the list item would be "What is my nom de plume?".

Hope that helps.

[1] http://www.w3.org/TR/wai-aria/roles#namecalculation

-- 
;;;;joseph.


'A: After all, it isn't rocket science.'
'K: Right. It's merely computer science.'
              - J. D. Klaun -

Received on Thursday, 13 February 2014 22:07:18 UTC