Title: [246736] trunk
Revision
246736
Author
[email protected]
Date
2019-06-24 08:03:46 -0700 (Mon, 24 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

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

Source/WebCore:

Test: accessibility/img-alt-attribute-unassigned-value.html

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

LayoutTests:

* accessibility/img-alt-attribute-unassigned-value-expected.txt: Added.
* accessibility/img-alt-attribute-unassigned-value.html: Added.
* inspector/dom/getAccessibilityPropertiesForNode-expected.txt:

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (246735 => 246736)


--- trunk/LayoutTests/ChangeLog	2019-06-24 14:58:25 UTC (rev 246735)
+++ trunk/LayoutTests/ChangeLog	2019-06-24 15:03:46 UTC (rev 246736)
@@ -1,3 +1,14 @@
+2019-06-24  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
+
+        Reviewed by Chris Fleizach.
+
+        * accessibility/img-alt-attribute-unassigned-value-expected.txt: Added.
+        * accessibility/img-alt-attribute-unassigned-value.html: Added.
+        * inspector/dom/getAccessibilityPropertiesForNode-expected.txt:
+
 2019-06-24  Antoine Quint  <[email protected]>
 
         [Pointer Events] Respect pointer capture when dispatching mouse boundary events and updating :hover

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


--- trunk/LayoutTests/accessibility/img-alt-attribute-unassigned-value-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/accessibility/img-alt-attribute-unassigned-value-expected.txt	2019-06-24 15:03:46 UTC (rev 246736)
@@ -0,0 +1,15 @@
+
+
+
+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 "cake2"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

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


--- trunk/LayoutTests/accessibility/img-alt-attribute-unassigned-value.html	                        (rev 0)
+++ trunk/LayoutTests/accessibility/img-alt-attribute-unassigned-value.html	2019-06-24 15:03:46 UTC (rev 246736)
@@ -0,0 +1,45 @@
+<!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="" /><br />
+            <img alt class="cake1 unassigned-alt" src="" /><br />
+            <img alt="cake2" src="" /><br />
+        </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 3 images, but one has an alt attribute that is unassigned, so it should be
+                // ignored. as a result, the image count is 2.
+                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,
+                // and use the filename as the alt text. currently it returns an empty string.
+                // this issue is documented here: <rdar://problem/51669261>
+                // shouldBeEqualToString("platformValueForW3CName(imagesGroup.childAtIndex(1))", "cake.png");
+                shouldBeEqualToString(
+                    'platformValueForW3CName(imagesGroup.childAtIndex(1))',
+                    'cake2',
+                );
+            }
+        </script>
+
+        <script src=""
+    </body>
+</html>

Modified: trunk/LayoutTests/inspector/dom/getAccessibilityPropertiesForNode-expected.txt (246735 => 246736)


--- trunk/LayoutTests/inspector/dom/getAccessibilityPropertiesForNode-expected.txt	2019-06-24 14:58:25 UTC (rev 246735)
+++ trunk/LayoutTests/inspector/dom/getAccessibilityPropertiesForNode-expected.txt	2019-06-24 15:03:46 UTC (rev 246736)
@@ -326,7 +326,7 @@
 <img src="" alt="x" aria-hidden="true">
     exists: true
     label: x
-    role: img
+    role: presentation
     ignored: true
     ignoredByDefault: true
     hidden: true
@@ -339,7 +339,7 @@
 <img src="" alt="">
     exists: true
     label: 
-    role: img
+    role: presentation
     ignored: true
 
 <img src=""
@@ -350,7 +350,7 @@
 <img src=""
     exists: true
     label: 
-    role: img
+    role: presentation
     ignored: true
 
 <input style="display:none;">

Modified: trunk/Source/WebCore/ChangeLog (246735 => 246736)


--- trunk/Source/WebCore/ChangeLog	2019-06-24 14:58:25 UTC (rev 246735)
+++ trunk/Source/WebCore/ChangeLog	2019-06-24 15:03:46 UTC (rev 246736)
@@ -1,3 +1,15 @@
+2019-06-24  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
+
+        Reviewed by Chris Fleizach.
+
+        Test: accessibility/img-alt-attribute-unassigned-value.html
+
+        * accessibility/AccessibilityObject.cpp:
+        (WebCore::AccessibilityObject::computedRoleString const):
+
 2019-06-24  Adrian Perez de Castro  <[email protected]>
 
         [WPE][GTK] Fixes for compilation with unified builds disabled

Modified: trunk/Source/WebCore/accessibility/AccessibilityObject.cpp (246735 => 246736)


--- trunk/Source/WebCore/accessibility/AccessibilityObject.cpp	2019-06-24 14:58:25 UTC (rev 246735)
+++ trunk/Source/WebCore/accessibility/AccessibilityObject.cpp	2019-06-24 15:03:46 UTC (rev 246736)
@@ -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 (role == AccessibilityRole::Image && 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