Title: [288100] trunk
Revision
288100
Author
[email protected]
Date
2022-01-17 11:50:14 -0800 (Mon, 17 Jan 2022)

Log Message

AX: Expose toggle buttons using role="button" as form controls.
https://bugs.webkit.org/show_bug.cgi?id=234119

Patch by Sepand Parhami <[email protected]> on 2022-01-17
Reviewed by Chris Fleizach.

Source/WebCore:

Add the ToggleButton role to the list of aria controls in isARIAControl so that it
is a control when checked by the accessibility object search.

Tests: LayoutTests/accessibility/mac/search-predicate-element-count.html

* accessibility/AccessibilityNodeObject.cpp:
(WebCore::AccessibilityNodeObject::isLabelable const):

Remove redundant check, isControl already covers it.

* accessibility/AccessibilityObject.cpp:
(WebCore::AccessibilityObject::isARIAControl):

LayoutTests:

Added a test case for button/role="button" with aria-presssed. Reordered a few things as
the previously named "inputs" section was not what was being checked in the test (it was
the number of buttons) and it had previously matched the number by coincidence.

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

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (288099 => 288100)


--- trunk/LayoutTests/ChangeLog	2022-01-17 19:44:14 UTC (rev 288099)
+++ trunk/LayoutTests/ChangeLog	2022-01-17 19:50:14 UTC (rev 288100)
@@ -1,3 +1,17 @@
+2022-01-17  Sepand Parhami  <[email protected]>
+
+        AX: Expose toggle buttons using role="button" as form controls.
+        https://bugs.webkit.org/show_bug.cgi?id=234119
+
+        Reviewed by Chris Fleizach.
+
+        Added a test case for button/role="button" with aria-presssed. Reordered a few things as
+        the previously named "inputs" section was not what was being checked in the test (it was
+        the number of buttons) and it had previously matched the number by coincidence.
+
+        * accessibility/mac/search-predicate-element-count-expected.txt:
+        * accessibility/mac/search-predicate-element-count.html:
+
 2022-01-17  Antti Koivisto  <[email protected]>
 
         Layered @import rules in <style> should be preloaded

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


--- trunk/LayoutTests/accessibility/mac/search-predicate-element-count-expected.txt	2022-01-17 19:44:14 UTC (rev 288099)
+++ trunk/LayoutTests/accessibility/mac/search-predicate-element-count-expected.txt	2022-01-17 19:50:14 UTC (rev 288100)
@@ -6,8 +6,8 @@
 PASS tableCount is 2
 PASS linkCount is 3
 PASS imageCount is 4
-PASS inputCount is 5
-PASS controlCount is 12
+PASS buttonCount is 7
+PASS controlCount is 16
 PASS headingCount is 6
 PASS onscreenCount is 6
 PASS offscreenCount is 4

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


--- trunk/LayoutTests/accessibility/mac/search-predicate-element-count.html	2022-01-17 19:44:14 UTC (rev 288099)
+++ trunk/LayoutTests/accessibility/mac/search-predicate-element-count.html	2022-01-17 19:50:14 UTC (rev 288100)
@@ -43,23 +43,29 @@
 <img alt="Cake" src=""
 <img alt="Cake" src=""
 <br>
-<!-- Inputs. -->
+
+<!-- Buttons. -->
 <input type="submit" value="Submit">
+<button>Button</button>
+<div role="button">Role button</div>
+<!-- The following two are popup buttons. -->
+<button aria-haspopup="menu">Button with aria-haspopup</button>
+<div role="button" aria-haspopup="menu">Role button with aria-haspopup</div>
+<!-- The following two are toggle buttons. -->
+<button aria-pressed="false">Button with aria-pressed</button>
+<div role="button" aria-pressed="false">Role button with aria-pressed</div>
+<br>
+
+<!-- Non-button controls. -->
 <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="textbox">Role textbox</div>
 <div role="combobox">Role combobox</div>
+<div role="listbox">Role listbox</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>
+<textarea>Textarea</textarea>
 
 </div>
 
@@ -85,14 +91,14 @@
         // Images.
         var imageCount = containerElement.uiElementCountForSearchPredicate(startElement, true, "AXGraphicSearchKey", "", false);
         shouldBe("imageCount", "4");
-        
-        // 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.
+        // Buttons.
+        var buttonCount = containerElement.uiElementCountForSearchPredicate(startElement, true, "AXButtonSearchKey", "", false);
+        shouldBe("buttonCount", "7");
+
+        // Form controls include buttons, checkboxes, etc, so the count should be the sum of buttons and other controls.
         var controlCount = containerElement.uiElementCountForSearchPredicate(startElement, true, "AXControlSearchKey", "", false);
-        shouldBe("controlCount", "12");
+        shouldBe("controlCount", "16");
 
         // Headings.
         var headingCount = containerElement.uiElementCountForSearchPredicate(startElement, true, "AXHeadingSearchKey", "", false);

Modified: trunk/Source/WebCore/ChangeLog (288099 => 288100)


--- trunk/Source/WebCore/ChangeLog	2022-01-17 19:44:14 UTC (rev 288099)
+++ trunk/Source/WebCore/ChangeLog	2022-01-17 19:50:14 UTC (rev 288100)
@@ -1,3 +1,23 @@
+2022-01-17  Sepand Parhami  <[email protected]>
+
+        AX: Expose toggle buttons using role="button" as form controls.
+        https://bugs.webkit.org/show_bug.cgi?id=234119
+
+        Reviewed by Chris Fleizach.
+
+        Add the ToggleButton role to the list of aria controls in isARIAControl so that it
+        is a control when checked by the accessibility object search.
+
+        Tests: LayoutTests/accessibility/mac/search-predicate-element-count.html
+
+        * accessibility/AccessibilityNodeObject.cpp:
+        (WebCore::AccessibilityNodeObject::isLabelable const):
+
+        Remove redundant check, isControl already covers it.
+
+        * accessibility/AccessibilityObject.cpp:
+        (WebCore::AccessibilityObject::isARIAControl):
+
 2022-01-17  Antti Koivisto  <[email protected]>
 
         Layered @import rules in <style> should be preloaded

Modified: trunk/Source/WebCore/accessibility/AccessibilityNodeObject.cpp (288099 => 288100)


--- trunk/Source/WebCore/accessibility/AccessibilityNodeObject.cpp	2022-01-17 19:44:14 UTC (rev 288099)
+++ trunk/Source/WebCore/accessibility/AccessibilityNodeObject.cpp	2022-01-17 19:50:14 UTC (rev 288100)
@@ -1328,7 +1328,7 @@
     if (!node)
         return false;
     
-    return is<HTMLInputElement>(*node) || AccessibilityObject::isARIAInput(ariaRoleAttribute()) || isControl() || isProgressIndicator() || isMeter();
+    return is<HTMLInputElement>(*node) || isControl() || isProgressIndicator() || isMeter();
 }
 
 String AccessibilityNodeObject::textForLabelElement(Element* element) const

Modified: trunk/Source/WebCore/accessibility/AccessibilityObject.cpp (288099 => 288100)


--- trunk/Source/WebCore/accessibility/AccessibilityObject.cpp	2022-01-17 19:44:14 UTC (rev 288099)
+++ trunk/Source/WebCore/accessibility/AccessibilityObject.cpp	2022-01-17 19:50:14 UTC (rev 288100)
@@ -929,6 +929,7 @@
     case AccessibilityRole::PopUpButton:
     case AccessibilityRole::Slider:
     case AccessibilityRole::TextArea:
+    case AccessibilityRole::ToggleButton:
         return true;
     default:
         return false;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to