Bug 185521

Summary: AX: Listbox and Combobox roles embedded in labels should participate in name calculation
Product: WebKit Reporter: Joanmarie Diggs <jdiggs>
Component: AccessibilityAssignee: Joanmarie Diggs <jdiggs>
Status: RESOLVED FIXED    
Severity: Normal CC: aboxhall, apinheiro, cfleizach, commit-queue, dmazzoni, ews-watchlist, jcraig, n_wang, samuel_white, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: All   
OS: All   
Attachments:
Description Flags
Patch
none
Archive of layout-test-results from ews204 for win-future
none
Patch
none
Archive of layout-test-results from ews116 for mac-sierra
none
Patch
none
Archive of layout-test-results from ews202 for win-future
none
Patch
none
Patch
none
patch for landing none

Joanmarie Diggs
Reported 2018-05-10 11:49:14 PDT
Given: <input type="checkbox" id="test1" /> <label for="test1" id="label">Flash the screen <ul role="listbox" style="list-style-type: none;"> <li role="option" aria-selected="false">1</li> <li role="option" aria-selected="true">2</li> <li role="option">3</li> </ul> times. </label> The accessible name of the checkbox should be "Flash the screen 2 times." (See step 2.E, bullet 3 of Accname[1]). It's currently "Flash the screen times." The same issue is been seen with the ARIA combobox role as well as with native select element with size > 1. [1] https://rawgit.com/w3c/accname/master/#mapping_additional_nd_te
Attachments
Patch (8.27 KB, patch)
2018-05-10 11:56 PDT, Joanmarie Diggs
no flags
Archive of layout-test-results from ews204 for win-future (12.75 MB, application/zip)
2018-05-10 13:54 PDT, EWS Watchlist
no flags
Patch (9.69 KB, patch)
2018-05-11 08:19 PDT, Joanmarie Diggs
no flags
Archive of layout-test-results from ews116 for mac-sierra (2.98 MB, application/zip)
2018-05-11 10:00 PDT, EWS Watchlist
no flags
Patch (13.16 KB, patch)
2018-05-11 10:14 PDT, Joanmarie Diggs
no flags
Archive of layout-test-results from ews202 for win-future (12.84 MB, application/zip)
2018-05-11 11:59 PDT, EWS Watchlist
no flags
Patch (13.90 KB, patch)
2018-05-11 12:16 PDT, Joanmarie Diggs
no flags
Patch (16.62 KB, patch)
2018-05-14 15:42 PDT, Joanmarie Diggs
no flags
patch for landing (16.73 KB, patch)
2018-05-14 17:04 PDT, Joanmarie Diggs
no flags
Radar WebKit Bug Importer
Comment 1 2018-05-10 11:49:27 PDT
Joanmarie Diggs
Comment 2 2018-05-10 11:56:01 PDT
chris fleizach
Comment 3 2018-05-10 13:04:40 PDT
Comment on attachment 340115 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=340115&action=review > LayoutTests/accessibility/text-alternative-calculation-from-listbox-expected.txt:6 > +Test 1 - W3C Name: how come this doesn't apply to Mac?
Joanmarie Diggs
Comment 4 2018-05-10 13:08:58 PDT
(In reply to chris fleizach from comment #3) > Comment on attachment 340115 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=340115&action=review > > > LayoutTests/accessibility/text-alternative-calculation-from-listbox-expected.txt:6 > > +Test 1 - W3C Name: > > how come this doesn't apply to Mac? You seem to expose it only through the AXTitleUIElement. On my platform, it's a flat string.
EWS Watchlist
Comment 5 2018-05-10 13:54:18 PDT
Comment on attachment 340115 [details] Patch Attachment 340115 [details] did not pass win-ews (win): Output: http://webkit-queues.webkit.org/results/7641907 New failing tests: http/tests/preload/onload_event.html
EWS Watchlist
Comment 6 2018-05-10 13:54:29 PDT
Created attachment 340125 [details] Archive of layout-test-results from ews204 for win-future The attached test failures were seen while running run-webkit-tests on the win-ews. Bot: ews204 Port: win-future Platform: CYGWIN_NT-6.1-2.9.0-0.318-5-3-x86_64-64bit
Joanmarie Diggs
Comment 7 2018-05-10 14:07:24 PDT
I don't *think* my patch could be responsible for the Windows failures. Chris, did you want me to do something regarding the AXTitleUIElement situation?
Nan Wang
Comment 8 2018-05-10 14:49:22 PDT
Comment on attachment 340115 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=340115&action=review >>> LayoutTests/accessibility/text-alternative-calculation-from-listbox-expected.txt:6 >>> +Test 1 - W3C Name: >> >> how come this doesn't apply to Mac? > > You seem to expose it only through the AXTitleUIElement. On my platform, it's a flat string. Yes I think on macOS it's reflected in AXTitle void AccessibilityNodeObject::titleElementText(Vector<AccessibilityText>& textOrder) const > LayoutTests/accessibility/text-alternative-calculation-from-listbox.html:65 > + debug("Test " + i + " - W3C Name: " + platformValueForW3CName(axElement)); If you make the change for macOS, platformValueForW3CName won't work since it's taking the description instead of the title.
Nan Wang
Comment 9 2018-05-10 15:02:18 PDT
Comment on attachment 340115 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=340115&action=review >>>> LayoutTests/accessibility/text-alternative-calculation-from-listbox-expected.txt:6 >>>> +Test 1 - W3C Name: >>> >>> how come this doesn't apply to Mac? >> >> You seem to expose it only through the AXTitleUIElement. On my platform, it's a flat string. > > Yes I think on macOS it's reflected in AXTitle > void AccessibilityNodeObject::titleElementText(Vector<AccessibilityText>& textOrder) const After some look, I think your changes should already work for macOS? Because AccessibilityNodeObject::textForLabelElement() is already using accessibleNameForNode(). And both AccessibilityNodeObject::titleElementText() and AccessibilityNodeObject::title() is getting the string from textForLabelElement(). Maybe you just need to update the test to account for macOS
Joanmarie Diggs
Comment 10 2018-05-11 08:19:20 PDT
Joanmarie Diggs
Comment 11 2018-05-11 08:27:28 PDT
(In reply to Nan Wang from comment #9) > Maybe you just need to update the test to account for macOS I updated the test to dump pretty much everything out about the checkboxes (whose labels contain listbox descendants which should participate in the name calculation for the checkboxes). The shared (non-platform-specific) results were generated on my iMac. I'm not seeing the information showing up in AXTitle. Furthermore, with the exception of test 3 -- which is the one test which worked as expected prior to my proposed fix -- I'm not seeing the "2" showing up anywhere on your platform for the label-y content. Please advise. As an aside, I suspect that this more detailed test will fail in Windows. I don't have a Windows environment, but I'll wait for EWS to spit up with the expected results.
EWS Watchlist
Comment 12 2018-05-11 10:00:08 PDT
Comment on attachment 340192 [details] Patch Attachment 340192 [details] did not pass mac-debug-ews (mac): Output: http://webkit-queues.webkit.org/results/7651697 New failing tests: accessibility/text-alternative-calculation-from-listbox.html
EWS Watchlist
Comment 13 2018-05-11 10:00:09 PDT
Created attachment 340193 [details] Archive of layout-test-results from ews116 for mac-sierra The attached test failures were seen while running run-webkit-tests on the mac-debug-ews. Bot: ews116 Port: mac-sierra Platform: Mac OS X 10.12.6
Joanmarie Diggs
Comment 14 2018-05-11 10:14:55 PDT
EWS Watchlist
Comment 15 2018-05-11 11:58:49 PDT
Comment on attachment 340196 [details] Patch Attachment 340196 [details] did not pass win-ews (win): Output: http://webkit-queues.webkit.org/results/7653045 New failing tests: accessibility/text-alternative-calculation-from-listbox.html
EWS Watchlist
Comment 16 2018-05-11 11:59:00 PDT
Created attachment 340211 [details] Archive of layout-test-results from ews202 for win-future The attached test failures were seen while running run-webkit-tests on the win-ews. Bot: ews202 Port: win-future Platform: CYGWIN_NT-6.1-2.9.0-0.318-5-3-x86_64-64bit
Joanmarie Diggs
Comment 17 2018-05-11 12:16:49 PDT
Nan Wang
Comment 18 2018-05-11 12:48:29 PDT
(In reply to Joanmarie Diggs (irc: joanie) from comment #11) > (In reply to Nan Wang from comment #9) > > > Maybe you just need to update the test to account for macOS > > I updated the test to dump pretty much everything out about the checkboxes > (whose labels contain listbox descendants which should participate in the > name calculation for the checkboxes). The shared (non-platform-specific) > results were generated on my iMac. I'm not seeing the information showing up > in AXTitle. > I think the issue here is that exposesTitleUIElement() is returning true so that it's not using the computed text as AXTitle. The AccessibilityLabel object is returned as the titleUIElement, VoiceOver on macOS would then use its description or its children's description to form the announcement. Couple thoughts I have: - Maybe we can return false for exposesTitleUIElement() in such case where !containsOnlyStaticText() for the AccessibilityLabel object. - Or we can return the computed name in AccessibilityLabel::stringValue() while still exposing this object as the titleUIElement. > Furthermore, with the exception of test 3 -- which is the one test which > worked as expected prior to my proposed fix -- I'm not seeing the "2" > showing up anywhere on your platform for the label-y content. > > Please advise. Isn't there a AXTitleUIElement Child 2 - AXValue: 2 > > As an aside, I suspect that this more detailed test will fail in Windows. I > don't have a Windows environment, but I'll wait for EWS to spit up with the > expected results.
Joanmarie Diggs
Comment 19 2018-05-11 13:15:52 PDT
(In reply to Nan Wang from comment #18) > Couple thoughts I have: > - Maybe we can return false for exposesTitleUIElement() in such case where > !containsOnlyStaticText() for the AccessibilityLabel object. > - Or we can return the computed name in AccessibilityLabel::stringValue() > while still exposing this object as the titleUIElement. Thanks for the suggestions! Seeing as how it's your platform, do you have a preference, or would you like me to try each independent of this bug and see what happens? > Isn't there a > AXTitleUIElement Child 2 - AXValue: 2 On your platform, only for test 3. And if memory serves me, that's the case even without my proposed fix.
Nan Wang
Comment 20 2018-05-11 13:41:50 PDT
(In reply to Joanmarie Diggs (irc: joanie) from comment #19) > (In reply to Nan Wang from comment #18) > > > Couple thoughts I have: > > - Maybe we can return false for exposesTitleUIElement() in such case where > > !containsOnlyStaticText() for the AccessibilityLabel object. > > - Or we can return the computed name in AccessibilityLabel::stringValue() > > while still exposing this object as the titleUIElement. > > Thanks for the suggestions! > > Seeing as how it's your platform, do you have a preference, or would you > like me to try each independent of this bug and see what happens? I think if you can make option 1 working it would be great. Because there might be extra work on the AT side for option 2. > > > Isn't there a > > AXTitleUIElement Child 2 - AXValue: 2 > > On your platform, only for test 3. And if memory serves me, that's the case > even without my proposed fix. I see. I think for AXList, macOS is using AXSelectedChildren to determine the selected child instead of exposing this info to AXValue
Joanmarie Diggs
Comment 21 2018-05-11 15:16:02 PDT
(In reply to Nan Wang from comment #20) > I think if you can make option 1 working it would be great. Because there > might be extra work on the AT side for option 2. Okie dokie. I did a quick trial and broke around 10 tests on your platform. Some of the errors are just due to the new behavior (no longer an AXTitleUIElement, but the AXTitle contains the flat string). Some need more investigation. It also broke the fix for the problem stated in the opening report on my platform. So, I'll definitely pursue this approach, but on Monday. :) Thanks again for the suggestions!
Joanmarie Diggs
Comment 22 2018-05-14 10:59:33 PDT
I'm now debugging the newly-introduced macOS failures that result from the proposed change. Questions: 1. Should an HTMLLabelElement which contains text and links still be treated as a valid AXTitleUIElement? 2. Should an HTMLLabelElement which lacks a "for" attribute and labels a descendant control be treated as the AXTitleUIElement for that descendant control? In both of the above cases, the HTMLLabelElement fails the containsOnlyStaticText() test and thus stops being the AXTitleUIElement expected in a number of layout tests. I don't know if I should just update the tests to reflect the new behavior or if I should create a method that only changes the behavior if the HTMLLabelElement contains a control which it is not labeling. Thoughts?
Nan Wang
Comment 23 2018-05-14 11:06:12 PDT
(In reply to Joanmarie Diggs (irc: joanie) from comment #22) > I'm now debugging the newly-introduced macOS failures that result from the > proposed change. Questions: > > 1. Should an HTMLLabelElement which contains text and links still be treated > as a valid AXTitleUIElement? > > 2. Should an HTMLLabelElement which lacks a "for" attribute and labels a > descendant control be treated as the AXTitleUIElement for that descendant > control? > > In both of the above cases, the HTMLLabelElement fails the > containsOnlyStaticText() test and thus stops being the AXTitleUIElement > expected in a number of layout tests. I don't know if I should just update > the tests to reflect the new behavior or if I should create a method that > only changes the behavior if the HTMLLabelElement contains a control which > it is not labeling. > > Thoughts? I think creating a method that only changes the behavior for label elements with controls might be better. Since we don't want to cause any regressions on the AT side as well.
Joanmarie Diggs
Comment 24 2018-05-14 15:42:25 PDT
Joanmarie Diggs
Comment 25 2018-05-14 15:47:40 PDT
(In reply to Nan Wang from comment #23) > I think creating a method that only changes the behavior for label elements > with controls might be better. Since we don't want to cause any regressions > on the AT side as well. Okie dokie. That's what I've done. Only one test has changed behavior and the test cases in question are labels which have descendant controls which are used to calculate the name of controls which are outside of the label (i.e. a variant of this bug). On a related note, I had to add a hack to the new layout test. For some reason in macOS (at least on my iMac), the checkboxes in the test had the correct AXTitle when I viewed the test using Accessibility Inspector. But if I ran the test as a Layout Test, the checkboxes were mostly (and often entirely) sans AXTitle. The hack (as you'll see in the test) is to touch the accessibility tree. Is this a known issue, and if so, is there a better solution? Thanks again!
Nan Wang
Comment 26 2018-05-14 16:29:34 PDT
(In reply to Joanmarie Diggs (irc: joanie) from comment #25) > (In reply to Nan Wang from comment #23) > > > I think creating a method that only changes the behavior for label elements > > with controls might be better. Since we don't want to cause any regressions > > on the AT side as well. > > Okie dokie. That's what I've done. Only one test has changed behavior and > the test cases in question are labels which have descendant controls which > are used to calculate the name of controls which are outside of the label > (i.e. a variant of this bug). > I think that's ok. > On a related note, I had to add a hack to the new layout test. For some > reason in macOS (at least on my iMac), the checkboxes in the test had the > correct AXTitle when I viewed the test using Accessibility Inspector. But if > I ran the test as a Layout Test, the checkboxes were mostly (and often > entirely) sans AXTitle. The hack (as you'll see in the test) is to touch the > accessibility tree. Is this a known issue, and if so, is there a better > solution? Hmmm this is strange. But it worked fine on other platforms? Is it possible that the layout is not yet finished when we calling those titles? We recently made changes to update Accessibility information post layout only. > > Thanks again!
Nan Wang
Comment 27 2018-05-14 16:29:40 PDT
(In reply to Joanmarie Diggs (irc: joanie) from comment #25) > (In reply to Nan Wang from comment #23) > > > I think creating a method that only changes the behavior for label elements > > with controls might be better. Since we don't want to cause any regressions > > on the AT side as well. > > Okie dokie. That's what I've done. Only one test has changed behavior and > the test cases in question are labels which have descendant controls which > are used to calculate the name of controls which are outside of the label > (i.e. a variant of this bug). > I think that's ok. > On a related note, I had to add a hack to the new layout test. For some > reason in macOS (at least on my iMac), the checkboxes in the test had the > correct AXTitle when I viewed the test using Accessibility Inspector. But if > I ran the test as a Layout Test, the checkboxes were mostly (and often > entirely) sans AXTitle. The hack (as you'll see in the test) is to touch the > accessibility tree. Is this a known issue, and if so, is there a better > solution? Hmmm this is strange. But it worked fine on other platforms? Is it possible that the layout is not yet finished when we calling those titles? We recently made changes to update Accessibility information post layout only. > > Thanks again!
Nan Wang
Comment 28 2018-05-14 16:30:05 PDT
Comment on attachment 340368 [details] Patch r=me. I think I'll let Chris take a final look.
chris fleizach
Comment 29 2018-05-14 16:32:58 PDT
Comment on attachment 340368 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=340368&action=review > Source/WebCore/accessibility/AccessibilityRenderObject.cpp:1419 > + // find out if this element is inside of a label element. Find out > Source/WebCore/accessibility/AccessibilityRenderObject.cpp:1420 > + // if so, it may be ignored because it's the label for a checkbox or radio button If so
Joanmarie Diggs
Comment 30 2018-05-14 17:04:29 PDT
Created attachment 340380 [details] patch for landing
WebKit Commit Bot
Comment 31 2018-05-14 17:32:12 PDT
Comment on attachment 340380 [details] patch for landing Clearing flags on attachment: 340380 Committed r231778: <https://trac.webkit.org/changeset/231778>
WebKit Commit Bot
Comment 32 2018-05-14 17:32:14 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.