Changeset 288100 in webkit


Ignore:
Timestamp:
Jan 17, 2022 11:50:14 AM (6 months ago)
Author:
commit-queue@webkit.org
Message:

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

Patch by Sepand Parhami <sparhami@apple.com> 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:
Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r288099 r288100  
     12022-01-17  Sepand Parhami  <sparhami@apple.com>
     2
     3        AX: Expose toggle buttons using role="button" as form controls.
     4        https://bugs.webkit.org/show_bug.cgi?id=234119
     5
     6        Reviewed by Chris Fleizach.
     7
     8        Added a test case for button/role="button" with aria-presssed. Reordered a few things as
     9        the previously named "inputs" section was not what was being checked in the test (it was
     10        the number of buttons) and it had previously matched the number by coincidence.
     11
     12        * accessibility/mac/search-predicate-element-count-expected.txt:
     13        * accessibility/mac/search-predicate-element-count.html:
     14
    1152022-01-17  Antti Koivisto  <antti@apple.com>
    216
  • trunk/LayoutTests/accessibility/mac/search-predicate-element-count-expected.txt

    r266207 r288100  
    77PASS linkCount is 3
    88PASS imageCount is 4
    9 PASS inputCount is 5
    10 PASS controlCount is 12
     9PASS buttonCount is 7
     10PASS controlCount is 16
    1111PASS headingCount is 6
    1212PASS onscreenCount is 6
  • trunk/LayoutTests/accessibility/mac/search-predicate-element-count.html

    r266207 r288100  
    4444<img alt="Cake" src="resources/cake.png">
    4545<br>
    46 <!-- Inputs. -->
     46
     47<!-- Buttons. -->
    4748<input type="submit" value="Submit">
     49<button>Button</button>
     50<div role="button">Role button</div>
     51<!-- The following two are popup buttons. -->
     52<button aria-haspopup="menu">Button with aria-haspopup</button>
     53<div role="button" aria-haspopup="menu">Role button with aria-haspopup</div>
     54<!-- The following two are toggle buttons. -->
     55<button aria-pressed="false">Button with aria-pressed</button>
     56<div role="button" aria-pressed="false">Role button with aria-pressed</div>
     57<br>
     58
     59<!-- Non-button controls. -->
    4860<div role="checkbox">Role checkbox</div>
    4961<div role="radio">Role radio</div>
    5062<div role="searchbox">Role searchbox</div>
    5163<div role="switch">Role switch</div>
    52 <br>
    53 
    54 <!-- Form controls. -->
    55 <button>Button</button>
    56 <div role="button">Role button</div>
     64<div role="textbox">Role textbox</div>
    5765<div role="combobox">Role combobox</div>
     66<div role="listbox">Role listbox</div>
    5867<div role="slider">Role slider</div>
    59 <div role="textbox">Role textbox</div>
    60 <!-- The following two are popup buttons and are also form controls. -->
    61 <button aria-haspopup="menu">Button with aria-haspopup</button>
    62 <div role="button" aria-haspopup="menu">Role button with aria-haspopup</div>
     68<textarea>Textarea</textarea>
    6369
    6470</div>
     
    8692        var imageCount = containerElement.uiElementCountForSearchPredicate(startElement, true, "AXGraphicSearchKey", "", false);
    8793        shouldBe("imageCount", "4");
    88        
    89         // Inputs.
    90         var inputCount = containerElement.uiElementCountForSearchPredicate(startElement, true, "AXButtonSearchKey", "", false);
    91         shouldBe("inputCount", "5");
    9294
    93         // Form controls include inputs, so the count should be the sum of inputs and controls.
     95        // Buttons.
     96        var buttonCount = containerElement.uiElementCountForSearchPredicate(startElement, true, "AXButtonSearchKey", "", false);
     97        shouldBe("buttonCount", "7");
     98
     99        // Form controls include buttons, checkboxes, etc, so the count should be the sum of buttons and other controls.
    94100        var controlCount = containerElement.uiElementCountForSearchPredicate(startElement, true, "AXControlSearchKey", "", false);
    95         shouldBe("controlCount", "12");
     101        shouldBe("controlCount", "16");
    96102
    97103        // Headings.
  • trunk/Source/WebCore/ChangeLog

    r288099 r288100  
     12022-01-17  Sepand Parhami  <sparhami@apple.com>
     2
     3        AX: Expose toggle buttons using role="button" as form controls.
     4        https://bugs.webkit.org/show_bug.cgi?id=234119
     5
     6        Reviewed by Chris Fleizach.
     7
     8        Add the ToggleButton role to the list of aria controls in isARIAControl so that it
     9        is a control when checked by the accessibility object search.
     10
     11        Tests: LayoutTests/accessibility/mac/search-predicate-element-count.html
     12
     13        * accessibility/AccessibilityNodeObject.cpp:
     14        (WebCore::AccessibilityNodeObject::isLabelable const):
     15
     16        Remove redundant check, isControl already covers it.
     17
     18        * accessibility/AccessibilityObject.cpp:
     19        (WebCore::AccessibilityObject::isARIAControl):
     20
    1212022-01-17  Antti Koivisto  <antti@apple.com>
    222
  • trunk/Source/WebCore/accessibility/AccessibilityNodeObject.cpp

    r288018 r288100  
    13291329        return false;
    13301330   
    1331     return is<HTMLInputElement>(*node) || AccessibilityObject::isARIAInput(ariaRoleAttribute()) || isControl() || isProgressIndicator() || isMeter();
     1331    return is<HTMLInputElement>(*node) || isControl() || isProgressIndicator() || isMeter();
    13321332}
    13331333
  • trunk/Source/WebCore/accessibility/AccessibilityObject.cpp

    r288027 r288100  
    930930    case AccessibilityRole::Slider:
    931931    case AccessibilityRole::TextArea:
     932    case AccessibilityRole::ToggleButton:
    932933        return true;
    933934    default:
Note: See TracChangeset for help on using the changeset viewer.