Title: [210150] trunk
Revision
210150
Author
[email protected]
Date
2016-12-25 23:47:56 -0800 (Sun, 25 Dec 2016)

Log Message

AX: Headers of table not read by VoiceOver
https://bugs.webkit.org/show_bug.cgi?id=158693
<rdar://problem/26771065>

Reviewed by Darin Adler.

Source/WebCore:

If a table cell header is hidden, by pushing off screen then the content won't be accessible.
It seems that unless specifically requested (such as using aria-hidden), we should try to return
that table cell header.

Test: accessibility/hidden-th-still-column-header.html

* accessibility/AccessibilityTableColumn.cpp:
(WebCore::AccessibilityTableColumn::headerObjectForSection):

LayoutTests:

* accessibility/hidden-th-still-column-header-expected.txt: Added.
* accessibility/hidden-th-still-column-header.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (210149 => 210150)


--- trunk/LayoutTests/ChangeLog	2016-12-26 06:35:07 UTC (rev 210149)
+++ trunk/LayoutTests/ChangeLog	2016-12-26 07:47:56 UTC (rev 210150)
@@ -1,3 +1,14 @@
+2016-12-25  Chris Fleizach  <[email protected]>
+
+        AX: Headers of table not read by VoiceOver
+        https://bugs.webkit.org/show_bug.cgi?id=158693
+        <rdar://problem/26771065>
+
+        Reviewed by Darin Adler.
+
+        * accessibility/hidden-th-still-column-header-expected.txt: Added.
+        * accessibility/hidden-th-still-column-header.html: Added.
+
 2016-12-25  Sam Weinig  <[email protected]>
 
         [WebIDL] Remove (most) custom bindings for the IndexedDB code

Added: trunk/LayoutTests/accessibility/hidden-th-still-column-header-expected.txt (0 => 210150)


--- trunk/LayoutTests/accessibility/hidden-th-still-column-header-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/accessibility/hidden-th-still-column-header-expected.txt	2016-12-26 07:47:56 UTC (rev 210150)
@@ -0,0 +1,14 @@
+header 1header2	header 3
+cell1	cell2	cell3
+This tests confirms even when a th tag is hidden, it will still be returned as a column header (unless it is hidden).
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS colHeaders.length is 2
+PASS colHeaders[0].childAtIndex(0).childAtIndex(0).stringValue is 'AXValue: header 1'
+PASS colHeaders[1].childAtIndex(0).stringValue is 'AXValue: header 3'
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/accessibility/hidden-th-still-column-header.html (0 => 210150)


--- trunk/LayoutTests/accessibility/hidden-th-still-column-header.html	                        (rev 0)
+++ trunk/LayoutTests/accessibility/hidden-th-still-column-header.html	2016-12-26 07:47:56 UTC (rev 210150)
@@ -0,0 +1,31 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src=""
+<script src=""
+</head>
+<body>
+
+<table border="1" id="table">
+<tr><th style="position: absolute; left: -99999px;">header 1</th>
+<th style="position: absolute; left: -99999px;" aria-hidden="true">header2</th>
+<th>header 3</th>
+</tr>
+<tr><td>cell1</td><td>cell2</td><td>cell3</td></tr>
+</table>
+
+<p id="description"></p>
+<div id="console"></div>
+<script>
+    description("This tests confirms even when a th tag is hidden, it will still be returned as a column header (unless it is hidden).");
+    if (window.accessibilityController) {
+        var table = accessibilityController.accessibleElementById("table");
+        var colHeaders = table.columnHeaders();
+        shouldBe("colHeaders.length", "2");
+        shouldBe("colHeaders[0].childAtIndex(0).childAtIndex(0).stringValue", "'AXValue: header 1'");
+        shouldBe("colHeaders[1].childAtIndex(0).stringValue", "'AXValue: header 3'");
+    }
+</script>
+<script src=""
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (210149 => 210150)


--- trunk/Source/WebCore/ChangeLog	2016-12-26 06:35:07 UTC (rev 210149)
+++ trunk/Source/WebCore/ChangeLog	2016-12-26 07:47:56 UTC (rev 210150)
@@ -1,3 +1,20 @@
+2016-12-25  Chris Fleizach  <[email protected]>
+
+        AX: Headers of table not read by VoiceOver
+        https://bugs.webkit.org/show_bug.cgi?id=158693
+        <rdar://problem/26771065>
+
+        Reviewed by Darin Adler.
+
+        If a table cell header is hidden, by pushing off screen then the content won't be accessible.
+        It seems that unless specifically requested (such as using aria-hidden), we should try to return
+        that table cell header.
+
+        Test: accessibility/hidden-th-still-column-header.html
+
+        * accessibility/AccessibilityTableColumn.cpp:
+        (WebCore::AccessibilityTableColumn::headerObjectForSection):
+
 2016-12-25  Yusuke Suzuki  <[email protected]>
 
         Propagate the source origin as much as possible

Modified: trunk/Source/WebCore/accessibility/AccessibilityTableColumn.cpp (210149 => 210150)


--- trunk/Source/WebCore/accessibility/AccessibilityTableColumn.cpp	2016-12-26 06:35:07 UTC (rev 210149)
+++ trunk/Source/WebCore/accessibility/AccessibilityTableColumn.cpp	2016-12-26 07:47:56 UTC (rev 210150)
@@ -31,6 +31,7 @@
 
 #include "AXObjectCache.h"
 #include "AccessibilityTableCell.h"
+#include "HTMLCollection.h"
 #include "HTMLElement.h"
 #include "HTMLNames.h"
 #include "RenderTable.h"
@@ -142,12 +143,21 @@
             if ((testCell->col() + (testCell->colSpan()-1)) < m_columnIndex)
                 break;
             
-            // If this does not have an element (like a <caption>) then check the next row
-            if (!testCell->element())
+            Node* testCellNode = testCell->element();
+            // If the RenderTableCell doesn't have an element because its anonymous,
+            // try to see if we can find the original cell element to check if it has a <th> tag.
+            if (!testCellNode && testCell->isAnonymous()) {
+                if (Element* parentElement = testCell->parent() ? testCell->parent()->element() : nullptr) {
+                    if (parentElement->hasTagName(trTag) && testCol < static_cast<int>(parentElement->countChildNodes()))
+                        testCellNode = parentElement->traverseToChildAt(testCol);
+                }
+            }
+
+            if (!testCellNode)
                 continue;
             
             // If th is required, but we found an element that doesn't have a th tag, we can stop looking.
-            if (thTagRequired && !testCell->element()->hasTagName(thTag))
+            if (thTagRequired && !testCellNode->hasTagName(thTag))
                 break;
             
             cell = testCell;
@@ -158,7 +168,11 @@
     if (!cell)
         return nullptr;
 
-    return axObjectCache()->getOrCreate(cell);
+    auto* cellObject = axObjectCache()->getOrCreate(cell);
+    if (!cellObject || cellObject->accessibilityIsIgnored())
+        return nullptr;
+        
+    return cellObject;
 }
     
 bool AccessibilityTableColumn::computeAccessibilityIsIgnored() const
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to