- Revision
- 284796
- Author
- [email protected]
- Date
- 2021-10-25 10:58:01 -0700 (Mon, 25 Oct 2021)
Log Message
AX: Keyboard-focusable leaf nodes with labels should be accessible elements on iOS
https://bugs.webkit.org/show_bug.cgi?id=232126
Patch by Tyler Wilcock <[email protected]> on 2021-10-25
Reviewed by Andres Gonzalez.
Source/WebCore:
Consider any focusable leaf node that has a label to be an
accessible element on iOS. See Google Maps JS API usecase
in: https://bugs.webkit.org/show_bug.cgi?id=223492
Test: accessibility/ios-simulator/keyboard-focusable-leaf-nodes.html
* accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
(-[WebAccessibilityObjectWrapper determineIsAccessibilityElement]):
Rather than returning false as a fallback, call an element accessible
if it focusable, has a label, and is a leaf node (has no accessible
children).
(-[WebAccessibilityObjectWrapper accessibilityLabel]):
Don't compute `axTitle`, `axDescription`, `interactiveDescription`, and
`interactiveVideoDescription` until we actually need them (this is
a refactor unrelated to the patch title).
LayoutTests:
Add test ensuring focusable leaf nodes with labels are accessible elements on iOS.
* accessibility/ios-simulator/labeled-focusable-leaf-nodes-expected.txt: Added.
* accessibility/ios-simulator/labeled-focusable-leaf-nodes.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (284795 => 284796)
--- trunk/LayoutTests/ChangeLog 2021-10-25 17:56:29 UTC (rev 284795)
+++ trunk/LayoutTests/ChangeLog 2021-10-25 17:58:01 UTC (rev 284796)
@@ -1,3 +1,15 @@
+2021-10-25 Tyler Wilcock <[email protected]>
+
+ AX: Keyboard-focusable leaf nodes with labels should be accessible elements on iOS
+ https://bugs.webkit.org/show_bug.cgi?id=232126
+
+ Reviewed by Andres Gonzalez.
+
+ Add test ensuring focusable leaf nodes with labels are accessible elements on iOS.
+
+ * accessibility/ios-simulator/labeled-focusable-leaf-nodes-expected.txt: Added.
+ * accessibility/ios-simulator/labeled-focusable-leaf-nodes.html: Added.
+
2021-10-25 Eric Hutchison <[email protected]>
[ iOS15 Sim Release ] imported/w3c/web-platform-tests/webrtc/RTCDtlsTransport-state.html is a flaky failure (Harness Error (TIMEOUT)).
Added: trunk/LayoutTests/accessibility/ios-simulator/labeled-focusable-leaf-nodes-expected.txt (0 => 284796)
--- trunk/LayoutTests/accessibility/ios-simulator/labeled-focusable-leaf-nodes-expected.txt (rev 0)
+++ trunk/LayoutTests/accessibility/ios-simulator/labeled-focusable-leaf-nodes-expected.txt 2021-10-25 17:58:01 UTC (rev 284796)
@@ -0,0 +1,43 @@
+This test ensures keyboard-focusable leaf nodes with AXLabels are considered accessibility elements on iOS.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS !accessibilityController.accessibleElementById('div-empty') is true
+Testing ID div-empty-with-aria-label
+PASS element.isIgnored is false
+Testing ID div-content
+PASS element.isIgnored is true
+Testing ID div-content-with-aria-label
+PASS element.isIgnored is true
+Testing ID group-empty
+PASS element.isIgnored is true
+Testing ID group-empty-with-aria-label
+PASS element.isIgnored is false
+Testing ID group-content
+PASS element.isIgnored is true
+PASS !accessibilityController.accessibleElementById('blockquote-empty') is true
+Testing ID blockquote-empty-with-aria-label
+PASS element.isIgnored is false
+Testing ID blockquote-content
+PASS element.isIgnored is true
+Testing ID footer-empty
+PASS element.isIgnored is true
+Testing ID footer-empty-with-aria-label
+PASS element.isIgnored is false
+Testing ID radiogroup-empty
+PASS element.isIgnored is true
+Testing ID radiogroup-empty-with-aria-label
+PASS element.isIgnored is false
+PASS !accessibilityController.accessibleElementById('paragraph-empty') is true
+Testing ID paragraph-empty-with-aria-label
+PASS element.isIgnored is false
+Testing ID paragraph-content
+PASS element.isIgnored is true
+Testing ID paragraph-content-with-aria-label
+PASS element.isIgnored is true
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
+
Added: trunk/LayoutTests/accessibility/ios-simulator/labeled-focusable-leaf-nodes.html (0 => 284796)
--- trunk/LayoutTests/accessibility/ios-simulator/labeled-focusable-leaf-nodes.html (rev 0)
+++ trunk/LayoutTests/accessibility/ios-simulator/labeled-focusable-leaf-nodes.html 2021-10-25 17:58:01 UTC (rev 284796)
@@ -0,0 +1,75 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src=""
+<script src=""
+</head>
+<body>
+
+<div id="content">
+ <div id="div-empty" tabindex="0"></div>
+ <div id="div-empty-with-aria-label" tabindex="0" aria-label="div label"></div>
+ <div id="div-content" tabindex="0">Some text</div>
+ <div id="div-content-with-aria-label" tabindex="0" aria-label="div label">Some text</div>
+
+ <div id="group-empty" tabindex="0" role="group"></div>
+ <div id="group-empty-with-aria-label" tabindex="0" role="group" aria-label="group label"></div>
+ <div id="group-content" tabindex="0" role="group">Some text</div>
+
+ <blockquote id="blockquote-empty" tabindex="0"></blockquote>
+ <blockquote id="blockquote-empty-with-aria-label" tabindex="0" aria-label="blockquote label"></blockquote>
+ <blockquote id="blockquote-content" tabindex="0">To be, or not to be</blockquote>
+
+ <footer id="footer-empty" tabindex="0"></footer>
+ <footer id="footer-empty-with-aria-label" tabindex="0" aria-label="footer label"></footer>
+
+ <div id="radiogroup-empty" tabindex="0" role="radiogroup"></div>
+ <div id="radiogroup-empty-with-aria-label" tabindex="0" role="radiogroup" aria-label="radiogroup label"></div>
+
+ <p id="paragraph-empty" tabindex="0"></p>
+ <p id="paragraph-empty-with-aria-label" tabindex="0" aria-label="paragraph label"></p>
+ <p id="paragraph-content" tabindex="0">Hello world</p>
+ <p id="paragraph-content-with-aria-label" tabindex="0" aria-label="paragraph label">Hello world</p>
+</div>
+
+<script>
+ description("This test ensures keyboard-focusable leaf nodes with AXLabels are considered accessibility elements on iOS.");
+
+ var element;
+ const shouldBeIgnored = (id, expectIgnored) => {
+ element = accessibilityController.accessibleElementById(id);
+ debug(`Testing ID ${id}`);
+ shouldBe("element.isIgnored", `${expectIgnored}`);
+ };
+
+ if (window.accessibilityController) {
+ shouldBeTrue("!accessibilityController.accessibleElementById('div-empty')");
+ shouldBeIgnored("div-empty-with-aria-label", false);
+ shouldBeIgnored("div-content", true);
+ shouldBeIgnored("div-content-with-aria-label", true);
+
+ shouldBeIgnored("group-empty", true);
+ shouldBeIgnored("group-empty-with-aria-label", false);
+ shouldBeIgnored("group-content", true);
+
+ shouldBeTrue("!accessibilityController.accessibleElementById('blockquote-empty')");
+ shouldBeIgnored("blockquote-empty-with-aria-label", false);
+ shouldBeIgnored("blockquote-content", true);
+
+ shouldBeIgnored("footer-empty", true);
+ shouldBeIgnored("footer-empty-with-aria-label", false);
+
+ shouldBeIgnored("radiogroup-empty", true);
+ shouldBeIgnored("radiogroup-empty-with-aria-label", false);
+
+ shouldBeTrue("!accessibilityController.accessibleElementById('paragraph-empty')");
+ shouldBeIgnored("paragraph-empty-with-aria-label", false);
+ shouldBeIgnored("paragraph-content", true);
+ shouldBeIgnored("paragraph-content-with-aria-label", true);
+
+ document.getElementById("content").style.visibility = "hidden";
+ }
+</script>
+</body>
+</html>
+
Modified: trunk/Source/WebCore/ChangeLog (284795 => 284796)
--- trunk/Source/WebCore/ChangeLog 2021-10-25 17:56:29 UTC (rev 284795)
+++ trunk/Source/WebCore/ChangeLog 2021-10-25 17:58:01 UTC (rev 284796)
@@ -1,3 +1,26 @@
+2021-10-25 Tyler Wilcock <[email protected]>
+
+ AX: Keyboard-focusable leaf nodes with labels should be accessible elements on iOS
+ https://bugs.webkit.org/show_bug.cgi?id=232126
+
+ Reviewed by Andres Gonzalez.
+
+ Consider any focusable leaf node that has a label to be an
+ accessible element on iOS. See Google Maps JS API usecase
+ in: https://bugs.webkit.org/show_bug.cgi?id=223492
+
+ Test: accessibility/ios-simulator/keyboard-focusable-leaf-nodes.html
+
+ * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
+ (-[WebAccessibilityObjectWrapper determineIsAccessibilityElement]):
+ Rather than returning false as a fallback, call an element accessible
+ if it focusable, has a label, and is a leaf node (has no accessible
+ children).
+ (-[WebAccessibilityObjectWrapper accessibilityLabel]):
+ Don't compute `axTitle`, `axDescription`, `interactiveDescription`, and
+ `interactiveVideoDescription` until we actually need them (this is
+ a refactor unrelated to the patch title).
+
2021-10-25 Ziran Sun <[email protected]>
[CSS-grid] Need to set prefer width dirty for the child that has constraints to the grid area
Modified: trunk/Source/WebCore/accessibility/ios/WebAccessibilityObjectWrapperIOS.mm (284795 => 284796)
--- trunk/Source/WebCore/accessibility/ios/WebAccessibilityObjectWrapperIOS.mm 2021-10-25 17:56:29 UTC (rev 284795)
+++ trunk/Source/WebCore/accessibility/ios/WebAccessibilityObjectWrapperIOS.mm 2021-10-25 17:58:01 UTC (rev 284796)
@@ -937,7 +937,6 @@
if ([self isSVGGroupElement])
return true;
FALLTHROUGH;
- // All other elements are ignored on the iphone.
case AccessibilityRole::Annotation:
case AccessibilityRole::Application:
case AccessibilityRole::ApplicationAlert:
@@ -983,7 +982,6 @@
case AccessibilityRole::GridCell:
case AccessibilityRole::GrowArea:
case AccessibilityRole::HelpTag:
- case AccessibilityRole::Ignored:
case AccessibilityRole::Inline:
case AccessibilityRole::Insertion:
case AccessibilityRole::Label:
@@ -1009,8 +1007,8 @@
case AccessibilityRole::Outline:
case AccessibilityRole::Paragraph:
case AccessibilityRole::Pre:
- case AccessibilityRole::Presentational:
case AccessibilityRole::RadioGroup:
+ case AccessibilityRole::RowGroup:
case AccessibilityRole::RowHeader:
case AccessibilityRole::Row:
case AccessibilityRole::RubyBase:
@@ -1046,12 +1044,18 @@
case AccessibilityRole::TreeItem:
case AccessibilityRole::TreeGrid:
case AccessibilityRole::Toolbar:
- case AccessibilityRole::Unknown:
case AccessibilityRole::UserInterfaceTooltip:
case AccessibilityRole::WebApplication:
case AccessibilityRole::WebArea:
case AccessibilityRole::Window:
- case AccessibilityRole::RowGroup:
+ // Consider focusable leaf-nodes with a label to be accessible elements.
+ // https://bugs.webkit.org/show_bug.cgi?id=223492
+ return self.axBackingObject->isKeyboardFocusable()
+ && [self accessibilityElementCount] == 0
+ && self.axBackingObject->descriptionAttributeValue().stripWhiteSpace().length() > 0;
+ case AccessibilityRole::Ignored:
+ case AccessibilityRole::Presentational:
+ case AccessibilityRole::Unknown:
return false;
}
@@ -1174,13 +1178,6 @@
auto* backingObject = self.axBackingObject;
- // iOS doesn't distinguish between a title and description field,
- // so concatentation will yield the best result.
- NSString *axTitle = backingObject->titleAttributeValue();
- NSString *axDescription = backingObject->descriptionAttributeValue();
- NSString *landmarkDescription = [self ariaLandmarkRoleDescription];
- NSString *interactiveVideoDescription = [self interactiveVideoDescription];
-
// If self is static text inside a heading, the label should be the string
// value of the static text object, except when the heading has alternative
// text, in which case, that alternative text is returned here.
@@ -1200,6 +1197,13 @@
}
}
+ // iOS doesn't distinguish between a title and description field,
+ // so concatentation will yield the best result.
+ NSString *axTitle = backingObject->titleAttributeValue();
+ NSString *axDescription = backingObject->descriptionAttributeValue();
+ NSString *landmarkDescription = [self ariaLandmarkRoleDescription];
+ NSString *interactiveVideoDescription = [self interactiveVideoDescription];
+
// We should expose the value of the input type date or time through AXValue instead of AXTitle.
if (backingObject->isInputTypePopupButton() && [axTitle isEqualToString:[self accessibilityValue]])
axTitle = nil;