Bug 160009 - AX: aria-label not being used correctly in accessible name calculation of heading
Summary: AX: aria-label not being used correctly in accessible name calculation of hea...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Accessibility (show other bugs)
Version: Safari 9
Hardware: All All
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2016-07-20 21:12 PDT by Dylan Barrell
Modified: 2019-09-26 12:05 PDT (History)
11 users (show)

See Also:


Attachments
Patch (5.44 KB, patch)
2016-07-21 15:57 PDT, Nan Wang
no flags Details | Formatted Diff | Diff
Patch (5.49 KB, patch)
2016-07-21 16:09 PDT, Nan Wang
cfleizach: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dylan Barrell 2016-07-20 21:12:15 PDT
The accessible name calculation algorithm for ARIA https://www.w3.org/TR/wai-aria/roles#textalternativecomputation states that aria-label (step 2A) takes precedence over the content of an element (step 2C) for the calculation of the name of the element when that element's role allows both content or author as the source of the accessible name.

This codepen http://codepen.io/anon/pen/dXdEXx shows that VO on both OS X and iOS does not implement that algorithm correctly.

In the case of OS X, the rotor displays the correctly calculated text, but the spoken text does not match this. In the case of iOS, the incorrect text (content) is spoken instead of the aria-label text.
Comment 1 Radar WebKit Bug Importer 2016-07-20 21:13:20 PDT
<rdar://problem/27464404>
Comment 2 Nan Wang 2016-07-21 15:57:24 PDT
Created attachment 284275 [details]
Patch

Webkit is exposing the correct information. We can see that the heading has the correct label in web inspector. So I think on macOS we should let VoiceOver handle what to speak.
The patch is for iOS only.
Comment 3 chris fleizach 2016-07-21 16:02:22 PDT
Comment on attachment 284275 [details]
Patch

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

> Source/WebCore/accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:604
> +                    if (![wrapper accessibilityLabel].length)

the dot pattern looks strange for this method. can you
1) cache axLabel in an ivar 
then just use [axLabel length]
Comment 4 Nan Wang 2016-07-21 16:09:36 PDT
Created attachment 284278 [details]
Patch

Update from review
Comment 5 chris fleizach 2016-07-21 16:20:15 PDT
Comment on attachment 284278 [details]
Patch

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

> Source/WebCore/accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:604
> +                    NSString* headingLabel = [wrapper accessibilityLabel];

nit: for objc * is on the other side

NSString *headingLabel
Comment 6 Nan Wang 2016-07-21 16:49:52 PDT
Committed in:
https://trac.webkit.org/changeset/203538