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.
<rdar://problem/27464404>
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 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]
Created attachment 284278 [details] Patch Update from review
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
Committed in: https://trac.webkit.org/changeset/203538