Title: [204645] trunk
Revision
204645
Author
n_w...@apple.com
Date
2016-08-19 12:23:30 -0700 (Fri, 19 Aug 2016)

Log Message

AX: iOS, Wrong axLabel on static text if heading has multiple children
https://bugs.webkit.org/show_bug.cgi?id=160981

Reviewed by Chris Fleizach.

Source/WebCore:

Headings are using textUnderElement to compute the accessibilityLabel on iOS, so normally it's
the concatenation of all the children's accessibilityLabel. Therefore, we shouldn't use accessibilityLabel
to check for user defined text on headings. Instead, baseAccessibilityDescription will return the
alternate text we want.

Changes are covered in the modified test.

* accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
(-[WebAccessibilityObjectWrapper _accessibilityTraitsFromAncestors]):

LayoutTests:

* accessibility/ios-simulator/heading-with-aria-label-expected.txt:
* accessibility/ios-simulator/heading-with-aria-label.html:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (204644 => 204645)


--- trunk/LayoutTests/ChangeLog	2016-08-19 19:07:30 UTC (rev 204644)
+++ trunk/LayoutTests/ChangeLog	2016-08-19 19:23:30 UTC (rev 204645)
@@ -1,3 +1,13 @@
+2016-08-19  Nan Wang  <n_w...@apple.com>
+
+        AX: iOS, Wrong axLabel on static text if heading has multiple children
+        https://bugs.webkit.org/show_bug.cgi?id=160981
+
+        Reviewed by Chris Fleizach.
+
+        * accessibility/ios-simulator/heading-with-aria-label-expected.txt:
+        * accessibility/ios-simulator/heading-with-aria-label.html:
+
 2016-08-19  Carlos Alberto Lopez Perez  <clo...@igalia.com>
 
         [GTK] Gardening: Layout tests expectations updates and test rebaselines.

Modified: trunk/LayoutTests/accessibility/ios-simulator/heading-with-aria-label-expected.txt (204644 => 204645)


--- trunk/LayoutTests/accessibility/ios-simulator/heading-with-aria-label-expected.txt	2016-08-19 19:07:30 UTC (rev 204644)
+++ trunk/LayoutTests/accessibility/ios-simulator/heading-with-aria-label-expected.txt	2016-08-19 19:23:30 UTC (rev 204645)
@@ -1,4 +1,6 @@
-visible text visible text
+visible text visible text visible text
+text1link
+
 This tests that if heading has aria-label, it will override the visible text as necessary.
 
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
@@ -5,8 +7,12 @@
 
 
 PASS heading1Text.traits == heading2Text.traits is true
+PASS heading3Text.traits == heading2Text.traits is true
 PASS heading1Text.description is 'AXLabel: test label'
 PASS heading2Text.description is 'AXLabel: visible text'
+PASS heading3Text.description is 'AXLabel: hidden label'
+PASS heading4Text1.description is 'AXLabel: text1'
+PASS linkText.description is 'AXLabel: link'
 PASS successfullyParsed is true
 
 TEST COMPLETE

Modified: trunk/LayoutTests/accessibility/ios-simulator/heading-with-aria-label.html (204644 => 204645)


--- trunk/LayoutTests/accessibility/ios-simulator/heading-with-aria-label.html	2016-08-19 19:07:30 UTC (rev 204644)
+++ trunk/LayoutTests/accessibility/ios-simulator/heading-with-aria-label.html	2016-08-19 19:23:30 UTC (rev 204645)
@@ -8,9 +8,14 @@
 </head>
 <body id="body">
 
+<div id="hidden" style="display:none">hidden label</div>
+
 <span id="heading1" role="heading" aria-label="test label">visible text</span>
 <span id="heading2" role="heading">visible text</span>
+<span id="heading3" role="heading" aria-labelledby="hidden">visible text</span>
 
+<h2 id="heading4"><span>text1</span><a id="link" href=""
+
 <p id="description"></p>
 <div id="console"></div>
 
@@ -22,12 +27,24 @@
 
         var heading1Text = accessibilityController.accessibleElementById("heading1").childAtIndex(0);
         var heading2Text = accessibilityController.accessibleElementById("heading2").childAtIndex(0);
+        var heading3Text = accessibilityController.accessibleElementById("heading3").childAtIndex(0);
         
         // Get the trait so that the label will be set.
         shouldBeTrue("heading1Text.traits == heading2Text.traits");
+        shouldBeTrue("heading3Text.traits == heading2Text.traits");
         
         shouldBe("heading1Text.description", "'AXLabel: test label'");
         shouldBe("heading2Text.description", "'AXLabel: visible text'");
+        shouldBe("heading3Text.description", "'AXLabel: hidden label'");
+        
+        // When a heading has multiple children, ensure the children's
+        // labels are correct if aria-label is NOT set.
+        var heading4 = accessibilityController.accessibleElementById("heading4");
+        var heading4Text1 = heading4.childAtIndex(0);
+        var linkText = accessibilityController.accessibleElementById("link").childAtIndex(0);
+        
+        shouldBe("heading4Text1.description", "'AXLabel: text1'");
+        shouldBe("linkText.description", "'AXLabel: link'");
     }
 
     successfullyParsed = true;

Modified: trunk/Source/WebCore/ChangeLog (204644 => 204645)


--- trunk/Source/WebCore/ChangeLog	2016-08-19 19:07:30 UTC (rev 204644)
+++ trunk/Source/WebCore/ChangeLog	2016-08-19 19:23:30 UTC (rev 204645)
@@ -1,3 +1,20 @@
+2016-08-19  Nan Wang  <n_w...@apple.com>
+
+        AX: iOS, Wrong axLabel on static text if heading has multiple children
+        https://bugs.webkit.org/show_bug.cgi?id=160981
+
+        Reviewed by Chris Fleizach.
+
+        Headings are using textUnderElement to compute the accessibilityLabel on iOS, so normally it's
+        the concatenation of all the children's accessibilityLabel. Therefore, we shouldn't use accessibilityLabel
+        to check for user defined text on headings. Instead, baseAccessibilityDescription will return the 
+        alternate text we want.
+
+        Changes are covered in the modified test.
+
+        * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
+        (-[WebAccessibilityObjectWrapper _accessibilityTraitsFromAncestors]):
+
 2016-08-19  Johan K. Jensen  <johan_jen...@apple.com>
 
         Resource Timing: Make PerformanceEntryList a sequence as per spec

Modified: trunk/Source/WebCore/accessibility/ios/WebAccessibilityObjectWrapperIOS.mm (204644 => 204645)


--- trunk/Source/WebCore/accessibility/ios/WebAccessibilityObjectWrapperIOS.mm	2016-08-19 19:07:30 UTC (rev 204644)
+++ trunk/Source/WebCore/accessibility/ios/WebAccessibilityObjectWrapperIOS.mm	2016-08-19 19:23:30 UTC (rev 204645)
@@ -601,7 +601,7 @@
                 if (role == StaticTextRole) {
                     // We should only set the text value as the label when there's no
                     // alternate text on the heading parent.
-                    NSString *headingLabel = [wrapper accessibilityLabel];
+                    NSString *headingLabel = [wrapper baseAccessibilityDescription];
                     if (![headingLabel length])
                         [self setAccessibilityLabel:m_object->stringValue()];
                     else
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to