Title: [229879] trunk
Revision
229879
Author
[email protected]
Date
2018-03-22 18:41:44 -0700 (Thu, 22 Mar 2018)

Log Message

AX: Web table row count is incorrect when role row is added to <tr> in DOM
https://bugs.webkit.org/show_bug.cgi?id=183922

Reviewed by Chris Fleizach.

Source/WebCore:

Although the parent table for an ARIA grid row should be an ARIA table, we
should return the native table if the row is native <tr>.

Test: accessibility/row-with-aria-role-in-native-table.html

* accessibility/AccessibilityARIAGridRow.cpp:
(WebCore::AccessibilityARIAGridRow::parentTable const):

LayoutTests:

* accessibility/row-with-aria-role-in-native-table-expected.txt: Added.
* accessibility/row-with-aria-role-in-native-table.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (229878 => 229879)


--- trunk/LayoutTests/ChangeLog	2018-03-23 01:37:15 UTC (rev 229878)
+++ trunk/LayoutTests/ChangeLog	2018-03-23 01:41:44 UTC (rev 229879)
@@ -1,3 +1,13 @@
+2018-03-22  Nan Wang  <[email protected]>
+
+        AX: Web table row count is incorrect when role row is added to <tr> in DOM
+        https://bugs.webkit.org/show_bug.cgi?id=183922
+
+        Reviewed by Chris Fleizach.
+
+        * accessibility/row-with-aria-role-in-native-table-expected.txt: Added.
+        * accessibility/row-with-aria-role-in-native-table.html: Added.
+
 2018-03-22  Daniel Bates  <[email protected]>
 
         CSS mask images should be retrieved using potentially CORS-enabled fetch

Added: trunk/LayoutTests/accessibility/row-with-aria-role-in-native-table-expected.txt (0 => 229879)


--- trunk/LayoutTests/accessibility/row-with-aria-role-in-native-table-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/accessibility/row-with-aria-role-in-native-table-expected.txt	2018-03-23 01:41:44 UTC (rev 229879)
@@ -0,0 +1,12 @@
+Item 1
+This tests if a native tr element uses the 'row' role, but forgets to add role='grid' to the native table element, the table still exposes the right numbers of rows/cells.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS table.rowCount is 1
+PASS table.columnCount is 1
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/accessibility/row-with-aria-role-in-native-table.html (0 => 229879)


--- trunk/LayoutTests/accessibility/row-with-aria-role-in-native-table.html	                        (rev 0)
+++ trunk/LayoutTests/accessibility/row-with-aria-role-in-native-table.html	2018-03-23 01:41:44 UTC (rev 229879)
@@ -0,0 +1,32 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src=""
+</head>
+<body id="body">
+
+<table id="table">
+<thead>
+<tr role="row"><th>Item 1</th></tr>
+</thead>
+<tbody></tbody>
+</table>
+
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+
+    description("This tests if a native tr element uses the 'row' role, but forgets to add role='grid' to the native table element, the table still exposes the right numbers of rows/cells.");
+
+    if (window.accessibilityController) {
+        var table = accessibilityController.accessibleElementById("table");
+        shouldBe("table.rowCount", "1");
+        shouldBe("table.columnCount", "1");
+    }
+
+</script>
+
+<script src=""
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (229878 => 229879)


--- trunk/Source/WebCore/ChangeLog	2018-03-23 01:37:15 UTC (rev 229878)
+++ trunk/Source/WebCore/ChangeLog	2018-03-23 01:41:44 UTC (rev 229879)
@@ -1,3 +1,18 @@
+2018-03-22  Nan Wang  <[email protected]>
+
+        AX: Web table row count is incorrect when role row is added to <tr> in DOM
+        https://bugs.webkit.org/show_bug.cgi?id=183922
+
+        Reviewed by Chris Fleizach.
+
+        Although the parent table for an ARIA grid row should be an ARIA table, we
+        should return the native table if the row is native <tr>.
+
+        Test: accessibility/row-with-aria-role-in-native-table.html
+
+        * accessibility/AccessibilityARIAGridRow.cpp:
+        (WebCore::AccessibilityARIAGridRow::parentTable const):
+
 2018-03-22  Chris Dumez  <[email protected]>
 
         Include security origin in the service worker process name

Modified: trunk/Source/WebCore/accessibility/AccessibilityARIAGridRow.cpp (229878 => 229879)


--- trunk/Source/WebCore/accessibility/AccessibilityARIAGridRow.cpp	2018-03-23 01:37:15 UTC (rev 229878)
+++ trunk/Source/WebCore/accessibility/AccessibilityARIAGridRow.cpp	2018-03-23 01:41:44 UTC (rev 229879)
@@ -123,9 +123,10 @@
     // only have "row" elements, but if not, we still should handle it gracefully by finding the right table.
     for (AccessibilityObject* parent = parentObject(); parent; parent = parent->parentObject()) {
         // The parent table for an ARIA grid row should be an ARIA table.
+        // Unless the row is a native tr element.
         if (is<AccessibilityTable>(*parent)) {
             AccessibilityTable& tableParent = downcast<AccessibilityTable>(*parent);
-            if (tableParent.isExposableThroughAccessibility() && tableParent.isAriaTable())
+            if (tableParent.isExposableThroughAccessibility() && (tableParent.isAriaTable() || node()->hasTagName(trTag)))
                 return &tableParent;
         }
     }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to