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

Joseph wrote:

> <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?".  


Assuming this is validly nested in a list, your synopsis is correct within the context of the ARIA text computation, and will be exposed correct to the platform-specific accessibility tree in more or less the following form (note, indented to show nesting):

LIST ITEM { label: “What is my name?” }
    - TEXT NODE { value: “What is my ” }
    - LINK { label: “name” }
        -- TEXT NODE { value: “nom de plume” }
    - TEXT NODE { value: “?” }

So the ARIA computed name value is correct for both the LIST ITEM and the LINK, but it’s the screen reader’s prerogative to provide more information if it so chooses, including the text contents of the node. You may be able to convince the NVDA developers copied here that it would be better to only speak the computed label here, but NVDA’s behavior is theirs to decide, not the W3C’s to specify, so calling this a bug is not the right approach.

James


On Feb 13, 2014, at 2:06 PM, Joseph Scheuhammer <clown@alum.mit.edu> wrote:

> 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 23:10:36 UTC