Title: [123767] trunk
- Revision
- 123767
- Author
- cfleiz...@apple.com
- Date
- 2012-07-26 10:23:20 -0700 (Thu, 26 Jul 2012)
Log Message
WebKit should expose @title as label (AXTitle or AXDescription) sometimes instead of AXHelp, according to the ARIA text alt computation
https://bugs.webkit.org/show_bug.cgi?id=91911
Reviewed by Anders Carlsson.
Source/WebCore:
The ARIA spec states that the title attribute should be used as the last resort for a description of an element. WebKit needs to honor that.
Test: platform/mac/accessibility/title-attribute-used-as-last-resort.html
* accessibility/AccessibilityRenderObject.cpp:
(WebCore::AccessibilityRenderObject::helpText):
(WebCore::AccessibilityRenderObject::accessibilityDescription):
LayoutTests:
* platform/mac/accessibility/title-attribute-used-as-last-resort-expected.txt: Added.
* platform/mac/accessibility/title-attribute-used-as-last-resort.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (123766 => 123767)
--- trunk/LayoutTests/ChangeLog 2012-07-26 16:59:07 UTC (rev 123766)
+++ trunk/LayoutTests/ChangeLog 2012-07-26 17:23:20 UTC (rev 123767)
@@ -1,3 +1,13 @@
+2012-07-26 Chris Fleizach <cfleiz...@apple.com>
+
+ WebKit should expose @title as label (AXTitle or AXDescription) sometimes instead of AXHelp, according to the ARIA text alt computation
+ https://bugs.webkit.org/show_bug.cgi?id=91911
+
+ Reviewed by Anders Carlsson.
+
+ * platform/mac/accessibility/title-attribute-used-as-last-resort-expected.txt: Added.
+ * platform/mac/accessibility/title-attribute-used-as-last-resort.html: Added.
+
2012-07-26 Ádám Kallai <ka...@inf.u-szeged.hu>
[Qt] Unreviewed gardening. Fix after r123733.
Added: trunk/LayoutTests/platform/mac/accessibility/title-attribute-used-as-last-resort-expected.txt (0 => 123767)
--- trunk/LayoutTests/platform/mac/accessibility/title-attribute-used-as-last-resort-expected.txt (rev 0)
+++ trunk/LayoutTests/platform/mac/accessibility/title-attribute-used-as-last-resort-expected.txt 2012-07-26 17:23:20 UTC (rev 123767)
@@ -0,0 +1,20 @@
+text text
+This tests that the title attribute is used as the last resort for description when there is no other option available, but otherwise used as help text.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS accessibilityController.focusedElement.title is 'AXTitle: text'
+PASS accessibilityController.focusedElement.helpText is 'AXHelp: TITLE'
+PASS accessibilityController.focusedElement.title is 'AXTitle: text'
+PASS accessibilityController.focusedElement.helpText is 'AXHelp: HELP'
+PASS accessibilityController.focusedElement.description is 'AXDescription: TITLE'
+PASS accessibilityController.focusedElement.helpText is 'AXHelp: '
+PASS accessibilityController.focusedElement.description is 'AXDescription: TITLE'
+PASS accessibilityController.focusedElement.helpText is 'AXHelp: HELP'
+PASS accessibilityController.focusedElement.description is 'AXDescription: LABEL'
+PASS accessibilityController.focusedElement.helpText is 'AXHelp: HELP'
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/platform/mac/accessibility/title-attribute-used-as-last-resort.html (0 => 123767)
--- trunk/LayoutTests/platform/mac/accessibility/title-attribute-used-as-last-resort.html (rev 0)
+++ trunk/LayoutTests/platform/mac/accessibility/title-attribute-used-as-last-resort.html 2012-07-26 17:23:20 UTC (rev 123767)
@@ -0,0 +1,54 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src=""
+</head>
+<body id="body">
+
+<a id="link1" tabindex="0" href="" title="TITLE">text</a>
+<a id="link2" tabindex="0" href="" aria-help="HELP" title="TITLE">text</a>
+<a id="link3" tabindex="0" href="" title="TITLE"></a>
+<a id="link4" tabindex="0" href="" aria-help="HELP" title="TITLE"></a>
+<a id="link5" tabindex="0" href="" aria-help="HELP" aria-label="LABEL" title="TITLE"></a>
+
+<p id="description"></p>
+<div id="console"></div>
+<div id="notifications"></div>
+
+<script>
+
+ description("This tests that the title attribute is used as the last resort for description when there is no other option available, but otherwise used as help text.");
+
+ if (window.accessibilityController) {
+
+ // Case 1: title attribute, with text inside element.
+ document.getElementById("link1").focus();
+ shouldBe("accessibilityController.focusedElement.title", "'AXTitle: text'");
+ shouldBe("accessibilityController.focusedElement.helpText", "'AXHelp: TITLE'");
+
+ // Case 2: title attribute and aria-help attribute, with text inside element.
+ document.getElementById("link2").focus();
+ shouldBe("accessibilityController.focusedElement.title", "'AXTitle: text'");
+ shouldBe("accessibilityController.focusedElement.helpText", "'AXHelp: HELP'");
+
+ // Case 3: title attribute is only text available.
+ document.getElementById("link3").focus();
+ shouldBe("accessibilityController.focusedElement.description", "'AXDescription: TITLE'");
+ shouldBe("accessibilityController.focusedElement.helpText", "'AXHelp: '");
+
+ // Case 4: title attribute and aria-help are available.
+ document.getElementById("link4").focus();
+ shouldBe("accessibilityController.focusedElement.description", "'AXDescription: TITLE'");
+ shouldBe("accessibilityController.focusedElement.helpText", "'AXHelp: HELP'");
+
+ // Case 5: aria-help, title and aria-label are available.
+ document.getElementById("link5").focus();
+ shouldBe("accessibilityController.focusedElement.description", "'AXDescription: LABEL'");
+ shouldBe("accessibilityController.focusedElement.helpText", "'AXHelp: HELP'");
+ }
+
+</script>
+
+<script src=""
+</body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (123766 => 123767)
--- trunk/Source/WebCore/ChangeLog 2012-07-26 16:59:07 UTC (rev 123766)
+++ trunk/Source/WebCore/ChangeLog 2012-07-26 17:23:20 UTC (rev 123767)
@@ -1,3 +1,18 @@
+2012-07-27 Chris Fleizach <cfleiz...@apple.com>
+
+ WebKit should expose @title as label (AXTitle or AXDescription) sometimes instead of AXHelp, according to the ARIA text alt computation
+ https://bugs.webkit.org/show_bug.cgi?id=91911
+
+ Reviewed by Anders Carlsson.
+
+ The ARIA spec states that the title attribute should be used as the last resort for a description of an element. WebKit needs to honor that.
+
+ Test: platform/mac/accessibility/title-attribute-used-as-last-resort.html
+
+ * accessibility/AccessibilityRenderObject.cpp:
+ (WebCore::AccessibilityRenderObject::helpText):
+ (WebCore::AccessibilityRenderObject::accessibilityDescription):
+
2012-07-26 Vsevolod Vlasov <vse...@chromium.org>
Unreviewed r123761 follow-up, inspector closure compilation fix.
Modified: trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp (123766 => 123767)
--- trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp 2012-07-26 16:59:07 UTC (rev 123766)
+++ trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp 2012-07-26 17:23:20 UTC (rev 123767)
@@ -1036,13 +1036,16 @@
if (!describedBy.isEmpty())
return describedBy;
+ String descriptiveText = accessibilityDescription();
for (RenderObject* curr = m_renderer; curr; curr = curr->parent()) {
if (curr->node() && curr->node()->isHTMLElement()) {
const AtomicString& summary = static_cast<Element*>(curr->node())->getAttribute(summaryAttr);
if (!summary.isEmpty())
return summary;
+
+ // The title attribute should be used as help text, unless it is already being used as descriptive text.
const AtomicString& title = static_cast<Element*>(curr->node())->getAttribute(titleAttr);
- if (!title.isEmpty())
+ if (!title.isEmpty() && descriptiveText != title)
return title;
}
@@ -1498,6 +1501,10 @@
if (isWebArea())
return webAreaAccessibilityDescription();
+ // The description should fall back to the title attribute as a last resort.
+ if (title().isEmpty())
+ return getAttribute(titleAttr);
+
return String();
}
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes