Bug 27964

Summary: WAI-ARIA: radio button does not determine its label from text content
Product: WebKit Reporter: chris fleizach <cfleizach>
Component: AccessibilityAssignee: chris fleizach <cfleizach>
Status: RESOLVED FIXED    
Severity: Normal CC: darin
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: PC   
OS: OS X 10.5   
Attachments:
Description Flags
patch darin: review+

Description chris fleizach 2009-08-03 17:16:10 PDT
WAI-ARIA: radio button cannot determine its label from text content
Comment 1 chris fleizach 2009-08-04 09:23:22 PDT
*** Bug 27987 has been marked as a duplicate of this bug. ***
Comment 2 chris fleizach 2009-08-04 09:38:31 PDT
Created attachment 34070 [details]
patch
Comment 3 Darin Adler 2009-08-04 10:36:26 PDT
Comment on attachment 34070 [details]
patch

> -            ariaLabel.append(' ');
> +            
> +            if (i != (size-1))
> +                ariaLabel.append(' ');

Conventional format would be:

    if (i != size - 1)

without the extra parentheses and with spaces around the operator. Also, to avoid overflow, I think it should be:

    if (i + 1 < size)

instead.

Generally speaking it seems that the textUnderElement ought to contain the same kind of whitespace-collapsing logic that the normal rendering code does. This could be done by using the TextIterator instead of walking the nodes and concatenating them all. Not sure what bug it will cause that this just appends the DOM, but I suspect it will cause problems, especially when there are 

Also, I noticed that ariaAccessiblityName misspells the word accessibility.

> +2009-08-04  Chris Fleizach  <cfleizach@apple.com>
> +
> +        Reviewed by NOBODY (OOPS!).
> +
> +        Added test for 
> +        Bug 27964 - WAI-ARIA: radio button does not determine its label from text content
> +        https://bugs.webkit.org/show_bug.cgi?id=27964
> +
> +        Updated tests that expected the extra space at the end of some ARIA labels.
> +
> +        * accessibility/aria-labelledby-stay-within.html:
> +        * platform/mac/accessibility/aria-describedby-on-input-expected.txt:
> +        * platform/mac/accessibility/aria-labelledby-on-input-expected.txt:
> +        * platform/mac/accessibility/aria-radiobutton-text-expected.txt: Added.
> +        * platform/mac/accessibility/aria-radiobutton-text.html: Added.
> +
> +2009-08-04  Chris Fleizach  <cfleizach@apple.com>
> +
> +        Reviewed by NOBODY (OOPS!).
> +
> +        Need a short description and bug URL (OOPS!)
> +
> +        * accessibility/aria-labelledby-stay-within.html:
> +        * platform/mac/accessibility/aria-describedby-on-input-expected.txt:
> +        * platform/mac/accessibility/aria-labelledby-on-input-expected.txt:
> +

Double change log here.

Otherwise looks fine.

r=me as is, but consider the improvements I suggested.
Comment 4 Darin Adler 2009-08-04 10:45:28 PDT
(In reply to comment #3)
> (From update of attachment 34070 [details])
> Also, to avoid overflow, I think it should be:
> 
>     if (i + 1 < size)
> 
> instead.

Actually, there's no overflow issue, since you wouldn't be in the loop at all if size was 0, so please ignore that erroneous comment.
Comment 5 chris fleizach 2009-08-04 10:47:51 PDT
i'll file a new bug to make the change for textUnderElement()
Comment 6 Darin Adler 2009-08-04 10:51:09 PDT
(In reply to comment #3)
> Not sure what bug it will cause that this just appends
> the DOM, but I suspect it will cause problems, especially when there are

I meant to say "especially when there are" elements with "display: none" or "visibility: hidden" involved.
Comment 7 chris fleizach 2009-08-04 10:58:05 PDT
filed
https://bugs.webkit.org/show_bug.cgi?id=27989
so we can revisit that topic.

 i am also unsure what would happen if nodes were rendered hidden
Comment 8 chris fleizach 2009-08-04 11:16:11 PDT
http://trac.webkit.org/changeset/46770