COMMIT_MESSAGE

 1AX: iOS VO+Safari does not read <summary> role or state
 2https://bugs.webkit.org/show_bug.cgi?id=257162
 3rdar://109684906
 4
 5Reviewed by NOBODY (OOPS!).
 6
 7This patch fixes the calculation for AccessibilityObject::supportsExpanded() so that <summary> elements
 8describe their state when using iOS voiceover. For <details> elements, we cannot rely on checking the
 9aria-expanded attribute since that does not exist on details elements (the attribute 'open' is used instead).
 10This affects <summary> elements as they use their <detail> parents to calculate accessibilitySupportsARIAExpanded().
 11
 12iOS AX tests were also added to confirm that this is the case.
 13
 14* Source/WebCore/accessibility/AccessibilityObject.cpp:
 15Update AccessibilityObject::supportsExpanded().
 16
 17* Tools/WebKitTestRunner/InjectedBundle/AccessibilityUIElement.cpp:
 18* Tools/WebKitTestRunner/InjectedBundle/AccessibilityUIElement.h:
 19* Tools/WebKitTestRunner/InjectedBundle/Bindings/AccessibilityUIElement.idl:
 20* Tools/WebKitTestRunner/InjectedBundle/ios/AccessibilityUIElementIOS.mm:
 21Expose method for testing.
 22
 23* LayoutTests/accessibility/ios-simulator/aria-details-toggle-summary-expected.txt:
 24* LayoutTests/accessibility/ios-simulator/aria-details-toggle-summary.html:
 25New test for checking isExpanded, supportsExpanded.

Source/WebCore/accessibility/AccessibilityObject.cpp

@@bool AccessibilityObject::supportsExpanded() const
33573357 return true;
33583358
33593359 switch (roleValue()) {
 3360 case AccessibilityRole::Details:
 3361 return true;
33603362 case AccessibilityRole::Button:
33613363 case AccessibilityRole::CheckBox:
33623364 case AccessibilityRole::ColumnHeader:
33633365 case AccessibilityRole::ComboBox:
3364  case AccessibilityRole::Details:
33653366 case AccessibilityRole::DisclosureTriangle:
33663367 case AccessibilityRole::GridCell:
33673368 case AccessibilityRole::Link:

Tools/WebKitTestRunner/InjectedBundle/AccessibilityUIElement.cpp

@@bool AccessibilityUIElement::isInTable() const { return false; }
9494bool AccessibilityUIElement::isInLandmark() const { return false; }
9595bool AccessibilityUIElement::isInList() const { return false; }
9696bool AccessibilityUIElement::isMarkAnnotation() const { return false; }
 97bool AccessibilityUIElement::supportsExpanded() const { return false; }
9798#endif
9899
99100// Unsupported methods on various platforms. As they're implemented on other platforms this list should be modified.

Tools/WebKitTestRunner/InjectedBundle/AccessibilityUIElement.h

@@public:
200200
201201 bool isValid() const;
202202 bool isExpanded() const;
 203 bool supportsExpanded() const;
203204 bool isChecked() const;
204205 JSRetainPtr<JSStringRef> currentStateValue() const;
205206 JSRetainPtr<JSStringRef> sortDirection() const;

Tools/WebKitTestRunner/InjectedBundle/Bindings/AccessibilityUIElement.idl

304304 readonly attribute boolean isSearchField;
305305 readonly attribute boolean isTextArea;
306306 readonly attribute boolean isMarkAnnotation;
 307 readonly attribute boolean supportsExpanded;
307308
308309 readonly attribute boolean hasDocumentRoleAncestor;
309310 readonly attribute boolean hasWebApplicationAncestor;

Tools/WebKitTestRunner/InjectedBundle/ios/AccessibilityUIElementIOS.mm

@@- (BOOL)_accessibilityHasTouchEventListener;
9898- (NSString *)accessibilityExpandedTextValue;
9999- (NSString *)accessibilitySortDirection;
100100- (BOOL)accessibilityIsExpanded;
 101- (BOOL)accessibilitySupportsARIAExpanded;
101102- (BOOL)accessibilityIsIndeterminate;
102103- (NSUInteger)accessibilityBlockquoteLevel;
103104- (NSArray *)accessibilityFindMatchingObjects:(NSDictionary *)parameters;

@@bool AccessibilityUIElement::isExpanded() const
705706 return [m_element accessibilityIsExpanded];
706707}
707708
 709bool AccessibilityUIElement::supportsExpanded() const
 710{
 711 return [m_element accessibilitySupportsARIAExpanded];
 712}
 713
708714bool AccessibilityUIElement::isChecked() const
709715{
710716 return false;

LayoutTests/accessibility/ios-simulator/aria-details-toggle-summary-expected.txt

 1This verifies that the summary of a details element has the right isExpanded value.
 2
 3PASS: summaryElement.supportsExpanded === true
 4PASS: summaryElement.isExpanded === true
 5PASS: summaryElement.isExpanded === false
 6
 7PASS successfullyParsed is true
 8
 9TEST COMPLETE
 10Details example

LayoutTests/accessibility/ios-simulator/aria-details-toggle-summary.html

 1<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
 2<html>
 3<head>
 4<script src="../../resources/accessibility-helper.js"></script>
 5<script src="../../resources/js-test.js"></script>
 6</head>
 7<body>
 8
 9<details open id="details1">
 10 <summary id="summary1">Details example</summary>
 11 <p>
 12 This is some description, hidden when the details element is collapsed.
 13 </p>
 14</details>
 15<script>
 16 var result = "This verifies that the summary of a details element has the right isExpanded value.\n\n";
 17
 18 if (window.accessibilityController) {
 19 window.jsTestIsAsync = true;
 20
 21 var summaryElement = accessibilityController.accessibleElementById("summary1");
 22
 23 setTimeout(async () => {
 24 result += expect("summaryElement.supportsExpanded", "true")
 25 result += expect("summaryElement.isExpanded", "true");
 26 document.getElementById("details1").toggleAttribute("open");
 27 result += await expectAsync("summaryElement.isExpanded", "false");
 28
 29 debug(result);
 30 finishJSTest();
 31 }, 0);
 32 }
 33</script>
 34</body>
 35</html>
 36