Bug 120550 - AX: REGRESSION: @title is exposed as AXDescription when label label from contents already exists.
Summary: AX: REGRESSION: @title is exposed as AXDescription when label label from cont...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Accessibility (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: chris fleizach
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2013-08-30 14:42 PDT by James Craig
Modified: 2013-09-03 23:12 PDT (History)
8 users (show)

See Also:


Attachments
test case demonstrating bug (303 bytes, text/html)
2013-08-30 14:45 PDT, James Craig
no flags Details
patch (10.23 KB, patch)
2013-09-02 18:59 PDT, chris fleizach
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description James Craig 2013-08-30 14:42:30 PDT
AX: REGRESSION: @title is exposed as AXDescription when label label from contents already exists.

Presumably this is not traversing the contents correctly (considering the element to have no label from contents) and therefore exposing the @title value as AXDescription instead of the default AXHelp.
Comment 1 Radar WebKit Bug Importer 2013-08-30 14:43:23 PDT
<rdar://problem/14882968>
Comment 2 James Craig 2013-08-30 14:45:49 PDT
Created attachment 210162 [details]
test case demonstrating bug
Comment 3 James Craig 2013-08-30 14:47:19 PDT
Looks like it also exposes the contents as both AXDescription and AXHelp, which should never happen, and results in extremely redundant speech for VoiceOver.
Comment 4 chris fleizach 2013-09-02 18:59:48 PDT
Created attachment 210318 [details]
patch
Comment 5 Mario Sanchez Prada 2013-09-03 03:04:13 PDT
Comment on attachment 210318 [details]
patch

View in context: https://bugs.webkit.org/attachment.cgi?id=210318&action=review

> Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm:2040
> +        switch (text.textSource) {
> +        case VisibleText:
> +        case ChildrenText:
> +        case LabelByElementText:
> +            visibleTextAvailable = true;
> +        default:
> +            break;
> +        }
> +        
> +        if (text.textSource == TitleTagText && !visibleTextAvailable)
>              return text.text;

I believe this is safe just because TitleTagText sources are always appended "almost" at the end (in AccessibilityNodeObject::helpText() and before maybe adding a PlaceHolderText source in accessibilityText()). However, if the order was not always that one (e.g. what if you have some VisibleText source after the TitleTagText one?) then you might find yourself returning text.text here because visibleTextAvailable hasn't set to true yet.

Setting r+ anyway because this is Mac specific code and you definitely know better. Just commenting that in case you might want to consider it in order to protect against situations that might happen in the future if the assertion about the order in which TitleTagText source is being appended was no longer true.
Comment 6 chris fleizach 2013-09-03 22:48:14 PDT
(In reply to comment #5)
> (From update of attachment 210318 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=210318&action=review
> 
> > Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm:2040
> > +        switch (text.textSource) {
> > +        case VisibleText:
> > +        case ChildrenText:
> > +        case LabelByElementText:
> > +            visibleTextAvailable = true;
> > +        default:
> > +            break;
> > +        }
> > +        
> > +        if (text.textSource == TitleTagText && !visibleTextAvailable)
> >              return text.text;
> 
> I believe this is safe just because TitleTagText sources are always appended "almost" at the end (in AccessibilityNodeObject::helpText() and before maybe adding a PlaceHolderText source in accessibilityText()). However, if the order was not always that one (e.g. what if you have some VisibleText source after the TitleTagText one?) then you might find yourself returning text.text here because visibleTextAvailable hasn't set to true yet.
> 
> Setting r+ anyway because this is Mac specific code and you definitely know better. Just commenting that in case you might want to consider it in order to protect against situations that might happen in the future if the assertion about the order in which TitleTagText source is being appended was no longer true.

Yes this is part of the contract of the accessibilityText method. You rely on the order of the text being appended in importance

Thanks
Comment 7 WebKit Commit Bot 2013-09-03 23:12:36 PDT
Comment on attachment 210318 [details]
patch

Clearing flags on attachment: 210318

Committed r155022: <http://trac.webkit.org/changeset/155022>
Comment 8 WebKit Commit Bot 2013-09-03 23:12:38 PDT
All reviewed patches have been landed.  Closing bug.