- Revision
- 221918
- Author
- cfleiz...@apple.com
- Date
- 2017-09-12 09:31:41 -0700 (Tue, 12 Sep 2017)
Log Message
AX: On generic container elements, WebKit should distinguish between tooltip (e.g. @title) and label (e.g. @aria-label) attributes
https://bugs.webkit.org/show_bug.cgi?id=170475
<rdar://problem/31439222>
Reviewed by Joanmarie Diggs.
Source/WebCore:
Test: accessibility/title-tag-on-unimportant-elements-is-help-text.html
* accessibility/AccessibilityNodeObject.cpp:
(WebCore::AccessibilityNodeObject::helpText):
(WebCore::AccessibilityNodeObject::accessibilityDescription):
(WebCore::AccessibilityNodeObject::roleIgnoresTitle):
* accessibility/AccessibilityNodeObject.h:
LayoutTests:
* accessibility/title-tag-on-unimportant-elements-is-help-text-expected.txt: Added.
* accessibility/title-tag-on-unimportant-elements-is-help-text.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (221917 => 221918)
--- trunk/LayoutTests/ChangeLog 2017-09-12 15:35:10 UTC (rev 221917)
+++ trunk/LayoutTests/ChangeLog 2017-09-12 16:31:41 UTC (rev 221918)
@@ -1,3 +1,14 @@
+2017-09-12 Chris Fleizach <cfleiz...@apple.com>
+
+ AX: On generic container elements, WebKit should distinguish between tooltip (e.g. @title) and label (e.g. @aria-label) attributes
+ https://bugs.webkit.org/show_bug.cgi?id=170475
+ <rdar://problem/31439222>
+
+ Reviewed by Joanmarie Diggs.
+
+ * accessibility/title-tag-on-unimportant-elements-is-help-text-expected.txt: Added.
+ * accessibility/title-tag-on-unimportant-elements-is-help-text.html: Added.
+
2017-09-12 Ms2ger <ms2...@igalia.com>
Disallow passing null data to uniform1uiv() and friends.
Added: trunk/LayoutTests/accessibility/title-tag-on-unimportant-elements-is-help-text-expected.txt (0 => 221918)
--- trunk/LayoutTests/accessibility/title-tag-on-unimportant-elements-is-help-text-expected.txt (rev 0)
+++ trunk/LayoutTests/accessibility/title-tag-on-unimportant-elements-is-help-text-expected.txt 2017-09-12 16:31:41 UTC (rev 221918)
@@ -0,0 +1,18 @@
+a
+a
+
+This tests that if a semantically unimportant element has title text, that text is exposed as help text rather than descriptive text.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS platformValueForW3CDescription(accessibilityController.accessibleElementById('div1')) is 'test1'
+PASS platformValueForW3CName(accessibilityController.accessibleElementById('div1')) is ''
+PASS platformValueForW3CDescription(accessibilityController.accessibleElementById('div2')) is ''
+PASS platformValueForW3CName(accessibilityController.accessibleElementById('div2')) is 'test2'
+PASS platformValueForW3CDescription(accessibilityController.accessibleElementById('button1')) is ''
+PASS platformValueForW3CName(accessibilityController.accessibleElementById('button1')) is 'test5'
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/accessibility/title-tag-on-unimportant-elements-is-help-text.html (0 => 221918)
--- trunk/LayoutTests/accessibility/title-tag-on-unimportant-elements-is-help-text.html (rev 0)
+++ trunk/LayoutTests/accessibility/title-tag-on-unimportant-elements-is-help-text.html 2017-09-12 16:31:41 UTC (rev 221918)
@@ -0,0 +1,40 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src=""
+<script src=""
+</head>
+<body id="body">
+
+<div id="div1" title="test1">a</div>
+<div id="div2" role="group" title="test2">a</div>
+
+<button id="button1" title="test5"></button>
+
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+
+ description("This tests that if a semantically unimportant element has title text, that text is exposed as help text rather than descriptive text.");
+
+ if (window.accessibilityController) {
+
+ // div1 is unimportant, so description should be blank.
+ shouldBe("platformValueForW3CDescription(accessibilityController.accessibleElementById('div1'))", "'test1'");
+ shouldBe("platformValueForW3CName(accessibilityController.accessibleElementById('div1'))", "''");
+
+ // div2 has an author applied role, so title tag should be used for description.
+ shouldBe("platformValueForW3CDescription(accessibilityController.accessibleElementById('div2'))", "''");
+ shouldBe("platformValueForW3CName(accessibilityController.accessibleElementById('div2'))", "'test2'");
+
+ // button is a meaningful element, so it should have a description.
+ shouldBe("platformValueForW3CDescription(accessibilityController.accessibleElementById('button1'))", "''");
+ shouldBe("platformValueForW3CName(accessibilityController.accessibleElementById('button1'))", "'test5'");
+ }
+
+</script>
+
+<script src=""
+</body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (221917 => 221918)
--- trunk/Source/WebCore/ChangeLog 2017-09-12 15:35:10 UTC (rev 221917)
+++ trunk/Source/WebCore/ChangeLog 2017-09-12 16:31:41 UTC (rev 221918)
@@ -1,3 +1,19 @@
+2017-09-12 Chris Fleizach <cfleiz...@apple.com>
+
+ AX: On generic container elements, WebKit should distinguish between tooltip (e.g. @title) and label (e.g. @aria-label) attributes
+ https://bugs.webkit.org/show_bug.cgi?id=170475
+ <rdar://problem/31439222>
+
+ Reviewed by Joanmarie Diggs.
+
+ Test: accessibility/title-tag-on-unimportant-elements-is-help-text.html
+
+ * accessibility/AccessibilityNodeObject.cpp:
+ (WebCore::AccessibilityNodeObject::helpText):
+ (WebCore::AccessibilityNodeObject::accessibilityDescription):
+ (WebCore::AccessibilityNodeObject::roleIgnoresTitle):
+ * accessibility/AccessibilityNodeObject.h:
+
2017-09-12 Brent Fulgham <bfulg...@apple.com>
Show punycode to user if a URL mixes Armenian Seh or Vo with other scripts
Modified: trunk/Source/WebCore/accessibility/AccessibilityNodeObject.cpp (221917 => 221918)
--- trunk/Source/WebCore/accessibility/AccessibilityNodeObject.cpp 2017-09-12 15:35:10 UTC (rev 221917)
+++ trunk/Source/WebCore/accessibility/AccessibilityNodeObject.cpp 2017-09-12 16:31:41 UTC (rev 221918)
@@ -1452,7 +1452,7 @@
// type to HelpText.
const AtomicString& title = getAttribute(titleAttr);
if (!title.isEmpty()) {
- if (!isMeter())
+ if (!isMeter() && !roleIgnoresTitle())
textOrder.append(AccessibilityText(title, TitleTagText));
else
textOrder.append(AccessibilityText(title, HelpText));
@@ -1557,12 +1557,29 @@
// Both are used to generate what a screen reader speaks.
// If this point is reached (i.e. there's no accessibilityDescription) and there's no title(), we should fallback to using the title attribute.
// The title attribute is normally used as help text (because it is a tooltip), but if there is nothing else available, this should be used (according to ARIA).
- if (title().isEmpty())
+ // https://bugs.webkit.org/show_bug.cgi?id=170475: An exception is when the element is semantically unimportant. In those cases, title text should remain as help text.
+ if (title().isEmpty() && !roleIgnoresTitle())
return getAttribute(titleAttr);
return String();
}
+// Returns whether the role was not intended to play a semantically meaningful part of the
+// accessibility hierarchy. This applies to generic groups like <div>'s with no role value set.
+bool AccessibilityNodeObject::roleIgnoresTitle() const
+{
+ if (ariaRoleAttribute() != UnknownRole)
+ return false;
+
+ switch (roleValue()) {
+ case DivRole:
+ case UnknownRole:
+ return true;
+ default:
+ return false;
+ }
+}
+
String AccessibilityNodeObject::helpText() const
{
Node* node = this->node();
Modified: trunk/Source/WebCore/accessibility/AccessibilityNodeObject.h (221917 => 221918)
--- trunk/Source/WebCore/accessibility/AccessibilityNodeObject.h 2017-09-12 15:35:10 UTC (rev 221917)
+++ trunk/Source/WebCore/accessibility/AccessibilityNodeObject.h 2017-09-12 16:31:41 UTC (rev 221918)
@@ -189,7 +189,8 @@
void ariaLabeledByText(Vector<AccessibilityText>&) const;
bool computeAccessibilityIsIgnored() const override;
bool usesAltTagForTextComputation() const;
-
+ bool roleIgnoresTitle() const;
+
Node* m_node;
};