Title: [246320] trunk
Revision
246320
Author
[email protected]
Date
2019-06-11 09:42:39 -0700 (Tue, 11 Jun 2019)

Log Message

Web Inspector: AXI: Audit: image label test is throwing spurious errors on elements with existing alt attr, but no value: <img alt>
https://bugs.webkit.org/show_bug.cgi?id=194754
<rdar://problem/48144534>

Patch by Greg Doolittle <[email protected]> on 2019-06-11
Reviewed by Chris Fleizach.

Source/WebCore:

Tests: accessibility/img-alt-attribute-empty-string.html
       accessibility/img-alt-attribute-no-value.html

* accessibility/AccessibilityObject.cpp:
(WebCore::AccessibilityObject::computedRoleString const):

LayoutTests:

* accessibility/img-alt-attribute-empty-string-expected.txt: Added.
* accessibility/img-alt-attribute-empty-string.html: Added.
* accessibility/img-alt-attribute-no-value-expected.txt: Added.
* accessibility/img-alt-attribute-no-value.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (246319 => 246320)


--- trunk/LayoutTests/ChangeLog	2019-06-11 16:26:29 UTC (rev 246319)
+++ trunk/LayoutTests/ChangeLog	2019-06-11 16:42:39 UTC (rev 246320)
@@ -1,3 +1,16 @@
+2019-06-11  Greg Doolittle  <[email protected]>
+
+        Web Inspector: AXI: Audit: image label test is throwing spurious errors on elements with existing alt attr, but no value: <img alt>
+        https://bugs.webkit.org/show_bug.cgi?id=194754
+        <rdar://problem/48144534>
+
+        Reviewed by Chris Fleizach.
+
+        * accessibility/img-alt-attribute-empty-string-expected.txt: Added.
+        * accessibility/img-alt-attribute-empty-string.html: Added.
+        * accessibility/img-alt-attribute-no-value-expected.txt: Added.
+        * accessibility/img-alt-attribute-no-value.html: Added.
+
 2019-06-11  Shawn Roberts  <[email protected]>
 
         http/tests/resourceLoadStatistics/website-data-removal-for-site-navigated-to-with-link-decoration.html is a flaky failure and timeout

Added: trunk/LayoutTests/accessibility/img-alt-attribute-empty-string-expected.txt (0 => 246320)


--- trunk/LayoutTests/accessibility/img-alt-attribute-empty-string-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/accessibility/img-alt-attribute-empty-string-expected.txt	2019-06-11 16:42:39 UTC (rev 246320)
@@ -0,0 +1,15 @@
+
+
+
+This tests that img elements with alt attribute of empty string are ignored.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS imagesGroup.childrenCount is 2
+PASS platformValueForW3CName(imagesGroup.childAtIndex(0)) is "cake"
+PASS platformValueForW3CName(imagesGroup.childAtIndex(1)) is "more cake"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/accessibility/img-alt-attribute-empty-string.html (0 => 246320)


--- trunk/LayoutTests/accessibility/img-alt-attribute-empty-string.html	                        (rev 0)
+++ trunk/LayoutTests/accessibility/img-alt-attribute-empty-string.html	2019-06-11 16:42:39 UTC (rev 246320)
@@ -0,0 +1,38 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src=""
+<script src=""
+</head>
+<body id="body">
+
+<div tabindex="0" role="group" id="images">
+    <img alt="cake" src=""
+    <img alt="" src="" class="empty-string"><br>
+    <img alt="more cake" src=""
+</div>
+
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+
+    description("This tests that img elements with alt attribute of empty string are ignored.");
+
+    if (window.accessibilityController) {
+
+        document.getElementById("images").focus();
+        var imagesGroup = accessibilityController.focusedElement;
+        // <img alt="" /> should be ignored, so the count should be 2:
+        shouldBe("imagesGroup.childrenCount", "2"); 
+        // make sure alt text is being read before and after
+        shouldBeEqualToString("platformValueForW3CName(imagesGroup.childAtIndex(0))", "cake");
+        shouldBeEqualToString("platformValueForW3CName(imagesGroup.childAtIndex(1))", "more cake");
+    }
+
+</script>
+
+<script src=""
+</body>
+</html>
+

Added: trunk/LayoutTests/accessibility/img-alt-attribute-no-value-expected.txt (0 => 246320)


--- trunk/LayoutTests/accessibility/img-alt-attribute-no-value-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/accessibility/img-alt-attribute-no-value-expected.txt	2019-06-11 16:42:39 UTC (rev 246320)
@@ -0,0 +1,16 @@
+
+
+
+
+This tests that img elements with an alt attribute and no assigned value are ignored.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS imagesGroup.childrenCount is 2
+PASS platformValueForW3CName(imagesGroup.childAtIndex(0)) is "cake0"
+PASS platformValueForW3CName(imagesGroup.childAtIndex(1)) is "cake3"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/accessibility/img-alt-attribute-no-value.html (0 => 246320)


--- trunk/LayoutTests/accessibility/img-alt-attribute-no-value.html	                        (rev 0)
+++ trunk/LayoutTests/accessibility/img-alt-attribute-no-value.html	2019-06-11 16:42:39 UTC (rev 246320)
@@ -0,0 +1,44 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src=""
+<script src=""
+</head>
+<body id="body">
+
+<div tabindex="0" role="group" id="images">
+    <img alt="cake0" src=""
+    <img alt class="unassigned-alt cake1" src=""
+    <img class="no-alt cake2" src=""
+    <img alt="cake3" src=""
+</div>
+
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+
+description("This tests that img elements with an alt attribute and no assigned value are ignored.");
+if (window.accessibilityController) {
+    document.getElementById("images").focus();
+    var imagesGroup = accessibilityController.focusedElement;
+    // there are 4 images, but one has an alt attribute that is unassigned so it should be
+    // ignored. there is a second image without any alt attribute at all. this image should
+    // not be ignored. accessibilityController fails to recognize it. this has been
+    // documented in <rdar://problem/51283943>.
+    // as a result the image count is 2, but it should be 3.
+    shouldBe("imagesGroup.childrenCount", "2");
+    // make sure alt text is being read before and after
+    shouldBeEqualToString("platformValueForW3CName(imagesGroup.childAtIndex(0))", "cake0");
+    // accessiblityController should see the <img> element w/o alt attribute as an image,
+    // but it erroneously classifies it as presentation.. so it won't find the image and use the filename as alt text
+    // shouldBeEqualToString("platformValueForW3CName(imagesGroup.childAtIndex(2))", "cake.png");
+    shouldBeEqualToString("platformValueForW3CName(imagesGroup.childAtIndex(1))", "cake3");
+}
+
+</script>
+
+<script src=""
+</body>
+</html>
+

Modified: trunk/Source/WebCore/ChangeLog (246319 => 246320)


--- trunk/Source/WebCore/ChangeLog	2019-06-11 16:26:29 UTC (rev 246319)
+++ trunk/Source/WebCore/ChangeLog	2019-06-11 16:42:39 UTC (rev 246320)
@@ -1,3 +1,17 @@
+2019-06-11  Greg Doolittle  <[email protected]>
+
+        Web Inspector: AXI: Audit: image label test is throwing spurious errors on elements with existing alt attr, but no value: <img alt>
+        https://bugs.webkit.org/show_bug.cgi?id=194754
+        <rdar://problem/48144534>
+
+        Reviewed by Chris Fleizach.
+
+        Tests: accessibility/img-alt-attribute-empty-string.html
+               accessibility/img-alt-attribute-no-value.html
+
+        * accessibility/AccessibilityObject.cpp:
+        (WebCore::AccessibilityObject::computedRoleString const):
+
 2019-06-11  Sihui Liu  <[email protected]>
 
         Add a quirk for washingtonpost.com and nytimes.com

Modified: trunk/Source/WebCore/accessibility/AccessibilityObject.cpp (246319 => 246320)


--- trunk/Source/WebCore/accessibility/AccessibilityObject.cpp	2019-06-11 16:26:29 UTC (rev 246319)
+++ trunk/Source/WebCore/accessibility/AccessibilityObject.cpp	2019-06-11 16:42:39 UTC (rev 246320)
@@ -2493,6 +2493,9 @@
     // FIXME: Need a few special cases that aren't in the RoleMap: option, etc. http://webkit.org/b/128296
     AccessibilityRole role = roleValue();
 
+    if (accessibilityIsIgnored())
+        return reverseAriaRoleMap().get(static_cast<int>(AccessibilityRole::Presentational));
+
     // We do not compute a role string for generic block elements with user-agent assigned roles.
     if (role == AccessibilityRole::Group || role == AccessibilityRole::TextGroup)
         return "";
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to