Expose the aria-label attribute for <video> elements.
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 28 Jul 2019 00:42:36 +0000 (00:42 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 28 Jul 2019 00:42:36 +0000 (00:42 +0000)
https://bugs.webkit.org/show_bug.cgi?id=200169
<rdar://problem/51754558>

Patch by Andres Gonzalez <andresg_22@apple.com> on 2019-07-27
Reviewed by Chris Fleizach.

Source/WebCore:

Tests: accessibility/ios-simulator/media-with-aria-label.html
       accessibility/media-with-aria-label.html

We now expose the <video> element to accessibility clients as long as auto-play is not enabled.
* accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
(-[WebAccessibilityObjectWrapper accessibilityIsWebInteractiveVideo]):

LayoutTests:

* accessibility/ios-simulator/media-with-aria-label-expected.txt: Added.
* accessibility/ios-simulator/media-with-aria-label.html: Added.
* accessibility/media-with-aria-label-expected.txt: Added.
* accessibility/media-with-aria-label.html: Added.
* platform/win/TestExpectations:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@247891 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/accessibility/ios-simulator/media-with-aria-label-expected.txt [new file with mode: 0644]
LayoutTests/accessibility/ios-simulator/media-with-aria-label.html [new file with mode: 0644]
LayoutTests/accessibility/media-with-aria-label-expected.txt [new file with mode: 0644]
LayoutTests/accessibility/media-with-aria-label.html [new file with mode: 0644]
LayoutTests/platform/win/TestExpectations
Source/WebCore/ChangeLog
Source/WebCore/accessibility/ios/WebAccessibilityObjectWrapperIOS.mm

index 33b0026..264a0ae 100644 (file)
@@ -1,3 +1,17 @@
+2019-07-27  Andres Gonzalez  <andresg_22@apple.com>
+
+        Expose the aria-label attribute for <video> elements.
+        https://bugs.webkit.org/show_bug.cgi?id=200169
+        <rdar://problem/51754558>
+
+        Reviewed by Chris Fleizach.
+
+        * accessibility/ios-simulator/media-with-aria-label-expected.txt: Added.
+        * accessibility/ios-simulator/media-with-aria-label.html: Added.
+        * accessibility/media-with-aria-label-expected.txt: Added.
+        * accessibility/media-with-aria-label.html: Added.
+        * platform/win/TestExpectations:
+
 2019-07-26  Ryosuke Niwa  <rniwa@webkit.org>
 
         Moving right by word boundary right before an object element followed by a br element hangs
diff --git a/LayoutTests/accessibility/ios-simulator/media-with-aria-label-expected.txt b/LayoutTests/accessibility/ios-simulator/media-with-aria-label-expected.txt
new file mode 100644 (file)
index 0000000..997fbde
--- /dev/null
@@ -0,0 +1,13 @@
+
+This tests ensures that aria-label is conveyed for video and audio elements.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS video1.description is 'AXLabel: Video One, indefinite time'
+PASS audio1.description is 'AXLabel: Audio One, 0 seconds, indefinite time'
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/accessibility/ios-simulator/media-with-aria-label.html b/LayoutTests/accessibility/ios-simulator/media-with-aria-label.html
new file mode 100644 (file)
index 0000000..05c2c74
--- /dev/null
@@ -0,0 +1,29 @@
+<!DOCTYPE HTML><!-- webkit-test-runner [ enableModernMediaControls=false ] -->
+<html>
+<head>
+<script src="../../resources/js-test-pre.js"></script>
+</head>
+<body>
+
+<video id="video1" width=100 height=100 controls aria-label="Video One"></video>
+
+<br>
+
+<audio id="audio1" width=100 height=100 controls aria-label="Audio One"></audio>
+
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+    description("This tests ensures that aria-label is conveyed for video and audio elements.")
+
+    if (window.accessibilityController) {
+        var video1 = accessibilityController.accessibleElementById("video1");
+        shouldBe("video1.description", "'AXLabel: Video One, indefinite time'");
+        var audio1 = accessibilityController.accessibleElementById("audio1");
+        shouldBe("audio1.description", "'AXLabel: Audio One, 0 seconds, indefinite time'");
+    }
+</script>
+<script src="../../resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/accessibility/media-with-aria-label-expected.txt b/LayoutTests/accessibility/media-with-aria-label-expected.txt
new file mode 100644 (file)
index 0000000..4ac0331
--- /dev/null
@@ -0,0 +1,13 @@
+
+This tests ensures that aria-label is conveyed for video and audio elements.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS video1.description is 'AXDescription: Video One'
+PASS audio1.description is 'AXDescription: Audio One'
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/accessibility/media-with-aria-label.html b/LayoutTests/accessibility/media-with-aria-label.html
new file mode 100644 (file)
index 0000000..637c650
--- /dev/null
@@ -0,0 +1,29 @@
+<!DOCTYPE HTML><!-- webkit-test-runner [ enableModernMediaControls=false ] -->
+<html>
+<head>
+<script src="../resources/js-test-pre.js"></script>
+</head>
+<body>
+
+<video id="video1" width=100 height=100 controls aria-label="Video One"></video>
+
+<br>
+
+<audio id="audio1" width=100 height=100 controls aria-label="Audio One"></audio>
+
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+    description("This tests ensures that aria-label is conveyed for video and audio elements.")
+
+    if (window.accessibilityController) {
+        var video1 = accessibilityController.accessibleElementById("video1");
+        shouldBe("video1.description", "'AXDescription: Video One'");
+        var audio1 = accessibilityController.accessibleElementById("audio1");
+        shouldBe("audio1.description", "'AXDescription: Audio One'");
+    }
+</script>
+<script src="../resources/js-test-post.js"></script>
+</body>
+</html>
index c6543cf..b2e5923 100644 (file)
@@ -1700,6 +1700,7 @@ webkit.org/b/184676 accessibility/ARIA-reflection.html [ Skip ]
 
 # Not implemented on Win
 accessibility/insert-newline.html [ Skip ]
+accessibility/media-with-aria-label.html [ Skip ]
 
 ################################################################################
 #######################   End Accessibility Issues   ###########################
index 9ad0b54..3f0b535 100644 (file)
@@ -1,3 +1,18 @@
+2019-07-27  Andres Gonzalez  <andresg_22@apple.com>
+
+        Expose the aria-label attribute for <video> elements.
+        https://bugs.webkit.org/show_bug.cgi?id=200169
+        <rdar://problem/51754558>
+
+        Reviewed by Chris Fleizach.
+
+        Tests: accessibility/ios-simulator/media-with-aria-label.html
+               accessibility/media-with-aria-label.html
+
+        We now expose the <video> element to accessibility clients as long as auto-play is not enabled.
+        * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
+        (-[WebAccessibilityObjectWrapper accessibilityIsWebInteractiveVideo]):
+
 2019-07-26  Saam Barati  <sbarati@apple.com>
 
         Unreviewed. Remove invalid assertion after r247878.
index dce76c3..9500c0a 100644 (file)
@@ -682,13 +682,12 @@ static AccessibilityObjectWrapper* AccessibilityUnignoredAncestor(AccessibilityO
 {
     if (![self _prepareAccessibilityCall])
         return NO;
-    
-    // Only make the video object interactive if it plays inline and has no native controls.
+
     if (m_object->roleValue() != AccessibilityRole::Video || !is<AccessibilityMediaObject>(m_object))
         return NO;
-    
-    AccessibilityMediaObject* mediaObject = downcast<AccessibilityMediaObject>(m_object);
-    return !mediaObject->isAutoplayEnabled() && mediaObject->isPlayingInline() && !downcast<AccessibilityMediaObject>(m_object)->hasControlsAttributeSet();
+
+    // Convey the video object as interactive if auto-play is not enabled.
+    return !downcast<AccessibilityMediaObject>(*m_object).isAutoplayEnabled();
 }
 
 - (NSString *)interactiveVideoDescription