Title: [266207] trunk
Revision
266207
Author
[email protected]
Date
2020-08-26 17:08:22 -0700 (Wed, 26 Aug 2020)

Log Message

Buttons with aria-haspopup attribute are not exposed to accessibility clients as form controls.
https://bugs.webkit.org/show_bug.cgi?id=215866

Reviewed by Chris Fleizach.

Source/WebCore:

Test: accessibility/mac/search-predicate-element-count.html.

Buttons with aria-haspopup were not included in the search results for
client queries for form controls. Added buttons with aria-haspopup which
have role PopUpButton, to the list of roles returned as form controls.

* accessibility/AccessibilityObject.cpp:
(WebCore::AccessibilityObject::isARIAInput): Re-wrote using a switch statement for clarity and maintainability.
(WebCore::AccessibilityObject::isARIAControl): Ditto.
* accessibility/AccessibilityObject.h:

Source/WebKit:

* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::handleSyntheticClick): isARIAControl false implies
isARIAInput false, thus removed the || isARIAInput call.

LayoutTests:

Expanded this test to include the case of buttons with aria-haspopup and
several other elements with ARIA roles that need to be retrieved when
clients search for input fields or form controls.

* accessibility/mac/search-predicate-element-count-expected.txt:
* accessibility/mac/search-predicate-element-count.html:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (266206 => 266207)


--- trunk/LayoutTests/ChangeLog	2020-08-27 00:06:29 UTC (rev 266206)
+++ trunk/LayoutTests/ChangeLog	2020-08-27 00:08:22 UTC (rev 266207)
@@ -1,3 +1,17 @@
+2020-08-26  Andres Gonzalez  <[email protected]>
+
+        Buttons with aria-haspopup attribute are not exposed to accessibility clients as form controls.
+        https://bugs.webkit.org/show_bug.cgi?id=215866
+
+        Reviewed by Chris Fleizach.
+
+        Expanded this test to include the case of buttons with aria-haspopup and
+        several other elements with ARIA roles that need to be retrieved when
+        clients search for input fields or form controls.
+
+        * accessibility/mac/search-predicate-element-count-expected.txt:
+        * accessibility/mac/search-predicate-element-count.html:
+
 2020-08-26  Said Abou-Hallawa  <[email protected]>
 
         Leading white spaces should be ignored when parsing an SVG list property

Modified: trunk/LayoutTests/accessibility/mac/search-predicate-element-count-expected.txt (266206 => 266207)


--- trunk/LayoutTests/accessibility/mac/search-predicate-element-count-expected.txt	2020-08-27 00:06:29 UTC (rev 266206)
+++ trunk/LayoutTests/accessibility/mac/search-predicate-element-count-expected.txt	2020-08-27 00:08:22 UTC (rev 266207)
@@ -7,6 +7,7 @@
 PASS linkCount is 3
 PASS imageCount is 4
 PASS inputCount is 5
+PASS controlCount is 12
 PASS headingCount is 6
 PASS onscreenCount is 6
 PASS offscreenCount is 4

Modified: trunk/LayoutTests/accessibility/mac/search-predicate-element-count.html (266206 => 266207)


--- trunk/LayoutTests/accessibility/mac/search-predicate-element-count.html	2020-08-27 00:06:29 UTC (rev 266206)
+++ trunk/LayoutTests/accessibility/mac/search-predicate-element-count.html	2020-08-27 00:08:22 UTC (rev 266207)
@@ -45,10 +45,22 @@
 <br>
 <!-- Inputs. -->
 <input type="submit" value="Submit">
-<input type="submit" value="Submit">
-<input type="submit" value="Submit">
-<input type="submit" value="Submit">
-<input type="submit" value="Submit">
+<div role="checkbox">Role checkbox</div>
+<div role="radio">Role radio</div>
+<div role="searchbox">Role searchbox</div>
+<div role="switch">Role switch</div>
+<br>
+
+<!-- Form controls. -->
+<button>Button</button>
+<div role="button">Role button</div>
+<div role="combobox">Role combobox</div>
+<div role="slider">Role slider</div>
+<div role="textbox">Role textbox</div>
+<!-- The following two are popup buttons and are also form controls. -->
+<button aria-haspopup="menu">Button with aria-haspopup</button>
+<div role="button" aria-haspopup="menu">Role button with aria-haspopup</div>
+
 </div>
 
 <p id="description"></p>
@@ -77,24 +89,27 @@
         // Inputs.
         var inputCount = containerElement.uiElementCountForSearchPredicate(startElement, true, "AXButtonSearchKey", "", false);
         shouldBe("inputCount", "5");
-        
+
+        // Form controls include inputs, so the count should be the sum of inputs and controls.
+        var controlCount = containerElement.uiElementCountForSearchPredicate(startElement, true, "AXControlSearchKey", "", false);
+        shouldBe("controlCount", "12");
+
         // Headings.
         var headingCount = containerElement.uiElementCountForSearchPredicate(startElement, true, "AXHeadingSearchKey", "", false);
         shouldBe("headingCount", "6");
-        
+
         // Onscreen
         var _onscreenCount_ = containerElement.uiElementCountForSearchPredicate(startElement, true, "AXHeadingSearchKey", "", false);
         shouldBe("onscreenCount", "6");
-        
+
         // Offscreen
         var offscreenCount = containerElement.uiElementCountForSearchPredicate(startElement, true, "AXHeadingSearchKey", "", true);
         shouldBe("offscreenCount", "4");
-        
+
         // Hide superfluous text.
         document.getElementById("container").style.display = "none";
     }
 </script>
-
 <script src=""
 </body>
 </html>

Modified: trunk/Source/WebCore/ChangeLog (266206 => 266207)


--- trunk/Source/WebCore/ChangeLog	2020-08-27 00:06:29 UTC (rev 266206)
+++ trunk/Source/WebCore/ChangeLog	2020-08-27 00:08:22 UTC (rev 266207)
@@ -1,3 +1,21 @@
+2020-08-26  Andres Gonzalez  <[email protected]>
+
+        Buttons with aria-haspopup attribute are not exposed to accessibility clients as form controls.
+        https://bugs.webkit.org/show_bug.cgi?id=215866
+
+        Reviewed by Chris Fleizach.
+
+        Test: accessibility/mac/search-predicate-element-count.html.
+
+        Buttons with aria-haspopup were not included in the search results for
+        client queries for form controls. Added buttons with aria-haspopup which
+        have role PopUpButton, to the list of roles returned as form controls.
+
+        * accessibility/AccessibilityObject.cpp:
+        (WebCore::AccessibilityObject::isARIAInput): Re-wrote using a switch statement for clarity and maintainability.
+        (WebCore::AccessibilityObject::isARIAControl): Ditto.
+        * accessibility/AccessibilityObject.h:
+
 2020-08-26  Said Abou-Hallawa  <[email protected]>
 
         Leading white spaces should be ignored when parsing an SVG list property

Modified: trunk/Source/WebCore/accessibility/AccessibilityObject.cpp (266206 => 266207)


--- trunk/Source/WebCore/accessibility/AccessibilityObject.cpp	2020-08-27 00:06:29 UTC (rev 266206)
+++ trunk/Source/WebCore/accessibility/AccessibilityObject.cpp	2020-08-27 00:08:22 UTC (rev 266207)
@@ -790,14 +790,36 @@
 
 bool AccessibilityObject::isARIAInput(AccessibilityRole ariaRole)
 {
-    return ariaRole == AccessibilityRole::RadioButton || ariaRole == AccessibilityRole::CheckBox || ariaRole == AccessibilityRole::TextField || ariaRole == AccessibilityRole::Switch || ariaRole == AccessibilityRole::SearchField;
+    switch (ariaRole) {
+    case AccessibilityRole::CheckBox:
+    case AccessibilityRole::RadioButton:
+    case AccessibilityRole::SearchField:
+    case AccessibilityRole::Switch:
+    case AccessibilityRole::TextField:
+        return true;
+    default:
+        return false;
+    }
 }    
-    
+
 bool AccessibilityObject::isARIAControl(AccessibilityRole ariaRole)
 {
-    return isARIAInput(ariaRole) || ariaRole == AccessibilityRole::TextArea || ariaRole == AccessibilityRole::Button || ariaRole == AccessibilityRole::ComboBox || ariaRole == AccessibilityRole::Slider || ariaRole == AccessibilityRole::ListBox;
+    if (isARIAInput(ariaRole))
+        return true;
+
+    switch (ariaRole) {
+    case AccessibilityRole::Button:
+    case AccessibilityRole::ComboBox:
+    case AccessibilityRole::ListBox:
+    case AccessibilityRole::PopUpButton:
+    case AccessibilityRole::Slider:
+    case AccessibilityRole::TextArea:
+        return true;
+    default:
+        return false;
+    }
 }
-    
+
 bool AccessibilityObject::isRangeControl() const
 {
     switch (roleValue()) {

Modified: trunk/Source/WebCore/accessibility/AccessibilityObject.h (266206 => 266207)


--- trunk/Source/WebCore/accessibility/AccessibilityObject.h	2020-08-27 00:06:29 UTC (rev 266206)
+++ trunk/Source/WebCore/accessibility/AccessibilityObject.h	2020-08-27 00:08:22 UTC (rev 266207)
@@ -275,7 +275,6 @@
     int layoutCount() const override { return 0; }
     double estimatedLoadingProgress() const override { return 0; }
     WEBCORE_EXPORT static bool isARIAControl(AccessibilityRole);
-    WEBCORE_EXPORT static bool isARIAInput(AccessibilityRole);
 
     bool supportsARIAOwns() const override { return false; }
     bool isActiveDescendantOfFocusedContainer() const override;
@@ -773,6 +772,7 @@
     bool isOnScreen() const override;
     bool dispatchTouchEvent();
 
+    static bool isARIAInput(AccessibilityRole);
     void ariaElementsFromAttribute(AccessibilityChildrenVector&, const QualifiedName&) const;
     void ariaElementsReferencedByAttribute(AccessibilityChildrenVector&, const QualifiedName&) const;
 

Modified: trunk/Source/WebKit/ChangeLog (266206 => 266207)


--- trunk/Source/WebKit/ChangeLog	2020-08-27 00:06:29 UTC (rev 266206)
+++ trunk/Source/WebKit/ChangeLog	2020-08-27 00:08:22 UTC (rev 266207)
@@ -1,3 +1,14 @@
+2020-08-26  Andres Gonzalez  <[email protected]>
+
+        Buttons with aria-haspopup attribute are not exposed to accessibility clients as form controls.
+        https://bugs.webkit.org/show_bug.cgi?id=215866
+
+        Reviewed by Chris Fleizach.
+
+        * WebProcess/WebPage/ios/WebPageIOS.mm:
+        (WebKit::WebPage::handleSyntheticClick): isARIAControl false implies
+        isARIAInput false, thus removed the || isARIAInput call.
+
 2020-08-26  Aditya Keerthi  <[email protected]>
 
         [iOS] Disabled options in the multi-select picker should not be selectable

Modified: trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm (266206 => 266207)


--- trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm	2020-08-27 00:06:29 UTC (rev 266206)
+++ trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm	2020-08-27 00:08:22 UTC (rev 266207)
@@ -753,7 +753,7 @@
         if (targetNode.document().quirks().shouldIgnoreAriaForFastPathContentObservationCheck())
             return false;
         auto ariaRole = AccessibilityObject::ariaRoleToWebCoreRole(downcast<Element>(targetNode).getAttribute(HTMLNames::roleAttr));
-        return AccessibilityObject::isARIAControl(ariaRole) || AccessibilityObject::isARIAInput(ariaRole);
+        return AccessibilityObject::isARIAControl(ariaRole);
     };
     auto targetNodeTriggersFastPath = nodeTriggersFastPath(nodeRespondingToClick);
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to