Diff
Modified: trunk/LayoutTests/ChangeLog (89203 => 89204)
--- trunk/LayoutTests/ChangeLog 2011-06-18 20:18:04 UTC (rev 89203)
+++ trunk/LayoutTests/ChangeLog 2011-06-18 20:27:31 UTC (rev 89204)
@@ -1,3 +1,18 @@
+2011-06-18 Alice Boxhall <[email protected]>
+
+ Reviewed by Chris Fleizach.
+
+ Accessibility description for an element should make use of aria-labelledby.
+ https://bugs.webkit.org/show_bug.cgi?id=61995
+
+ * accessibility/aria-labelledby-on-input.html:
+ * accessibility/aria-labelledby-overrides-aria-label-expected.txt: Added.
+ * accessibility/aria-labelledby-overrides-aria-label.html: Added.
+ * accessibility/aria-labelledby-overrides-label-expected.txt:
+ * accessibility/aria-labelledby-overrides-label.html:
+ * accessibility/aria-labelledby-stay-within.html:
+ * platform/mac/accessibility/aria-labelledby-on-input-expected.txt:
+
2011-06-18 Adam Bergkvist <[email protected]>
Reviewed by Tony Gentilcore.
Modified: trunk/LayoutTests/accessibility/aria-labelledby-on-input.html (89203 => 89204)
--- trunk/LayoutTests/accessibility/aria-labelledby-on-input.html 2011-06-18 20:18:04 UTC (rev 89203)
+++ trunk/LayoutTests/accessibility/aria-labelledby-on-input.html 2011-06-18 20:27:31 UTC (rev 89204)
@@ -14,7 +14,7 @@
var labeledItem = document.getElementById("time");
labeledItem.focus();
var result = document.getElementById("result");
- result.innerText = "\nThe accessibility title is \"" + accessibilityController.focusedElement.title + "\"";
+ result.innerText = "\nThe accessibility description is \"" + accessibilityController.focusedElement.description + "\"";
}
</script>
</body>
Added: trunk/LayoutTests/accessibility/aria-labelledby-overrides-aria-label-expected.txt (0 => 89204)
--- trunk/LayoutTests/accessibility/aria-labelledby-overrides-aria-label-expected.txt (rev 0)
+++ trunk/LayoutTests/accessibility/aria-labelledby-overrides-aria-label-expected.txt 2011-06-18 20:27:31 UTC (rev 89204)
@@ -0,0 +1,18 @@
+Alpha Beta Delta Eta Epsilon Theta
+This tests that if aria-labelledby is used, then aria-label attributes are not used.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS usingNone.title is "AXTitle: Alpha"
+PASS usingNone.description is "AXDescription: "
+PASS usingLabel.title is "AXTitle: Beta"
+PASS usingLabel.description is "AXDescription: Gamma"
+PASS usingLabelledby.title is "AXTitle: Delta"
+PASS usingLabelledby.description is "AXDescription: Epsilon"
+PASS usingLabeledby.title is "AXTitle: Eta"
+PASS usingLabeledby.description is "AXDescription: Theta"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/accessibility/aria-labelledby-overrides-aria-label.html (0 => 89204)
--- trunk/LayoutTests/accessibility/aria-labelledby-overrides-aria-label.html (rev 0)
+++ trunk/LayoutTests/accessibility/aria-labelledby-overrides-aria-label.html 2011-06-18 20:27:31 UTC (rev 89204)
@@ -0,0 +1,68 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<link rel="stylesheet" href=""
+<script>
+var successfullyParsed = false;
+</script>
+<script src=""
+</head>
+<body id="body">
+
+<button id="using-none">Alpha</button>
+<button id="using-label" aria-label="Gamma">Beta</button>
+<button id="using-labelledby" aria-labelledby="epsilon" aria-label="Zeta">Delta</button>
+<button id="using-labeledby" aria-labeledby="theta" aria-label="Iota">Eta</button>
+<span id="epsilon">Epsilon</span>
+<span id="theta">Theta</span>
+
+<p id="description"></p>
+<ul id="console"></ul>
+
+<script>
+ description("This tests that if aria-labelledby is used, then aria-label attributes are not used.");
+
+ function log(str) {
+ var console = document.getElementById("console");
+ var li = document.createElement("li");
+ li.appendChild(document.createTextNode(str));
+ console.appendChild(li);
+ }
+
+ function logAXObject(obj) {
+ log("for " + obj.allAttributes());
+ log("children:\n" + obj.attributesOfChildren());
+ log("obj.title is " + obj.title);
+ log("obj.description is " + obj.description);
+ }
+
+ function getAccessibilityObject(id) {
+ var element = document.getElementById(id);
+ element.focus();
+ return accessibilityController.focusedElement;
+ }
+
+ if (window.accessibilityController) {
+ var usingNone = getAccessibilityObject("using-none");
+ shouldBe("usingNone.title", '"AXTitle: Alpha"');
+ shouldBe("usingNone.description", '"AXDescription: "');
+
+ var usingLabel = getAccessibilityObject("using-label");
+ shouldBe("usingLabel.title", '"AXTitle: Beta"');
+ shouldBe("usingLabel.description", '"AXDescription: Gamma"');
+
+ var usingLabelledby = getAccessibilityObject("using-labelledby");
+ shouldBe("usingLabelledby.title", '"AXTitle: Delta"');
+ shouldBe("usingLabelledby.description", '"AXDescription: Epsilon"');
+
+ var usingLabeledby = getAccessibilityObject("using-labeledby");
+ shouldBe("usingLabeledby.title", '"AXTitle: Eta"');
+ shouldBe("usingLabeledby.description", '"AXDescription: Theta"');
+ }
+
+ successfullyParsed = true;
+</script>
+
+<script src=""
+</body>
+</html>
Modified: trunk/LayoutTests/accessibility/aria-labelledby-overrides-label-expected.txt (89203 => 89204)
--- trunk/LayoutTests/accessibility/aria-labelledby-overrides-label-expected.txt 2011-06-18 20:18:04 UTC (rev 89203)
+++ trunk/LayoutTests/accessibility/aria-labelledby-overrides-label-expected.txt 2011-06-18 20:27:31 UTC (rev 89204)
@@ -4,7 +4,7 @@
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-PASS text.title is 'AXTitle: Shut down computer after 10 minutes'
+PASS text.description is 'AXDescription: Shut down computer after 10 minutes'
PASS text.titleUIElement().isValid is false
PASS labelElement.role is 'AXRole: AXStaticText'
PASS successfullyParsed is true
Modified: trunk/LayoutTests/accessibility/aria-labelledby-overrides-label.html (89203 => 89204)
--- trunk/LayoutTests/accessibility/aria-labelledby-overrides-label.html 2011-06-18 20:18:04 UTC (rev 89203)
+++ trunk/LayoutTests/accessibility/aria-labelledby-overrides-label.html 2011-06-18 20:27:31 UTC (rev 89204)
@@ -26,7 +26,7 @@
text.focus();
text = accessibilityController.focusedElement;
- shouldBe("text.title", "'AXTitle: Shut down computer after 10 minutes'");
+ shouldBe("text.description", "'AXDescription: Shut down computer after 10 minutes'");
// There should be no title UI element.
shouldBe("text.titleUIElement().isValid", "false");
Modified: trunk/LayoutTests/accessibility/aria-labelledby-stay-within.html (89203 => 89204)
--- trunk/LayoutTests/accessibility/aria-labelledby-stay-within.html 2011-06-18 20:18:04 UTC (rev 89203)
+++ trunk/LayoutTests/accessibility/aria-labelledby-stay-within.html 2011-06-18 20:27:31 UTC (rev 89204)
@@ -32,11 +32,11 @@
var labeledItem = document.getElementById("rep");
labeledItem.focus();
var result = document.getElementById("result");
- if ( accessibilityController.focusedElement.title == "AXTitle: Reply Item Five" ) {
+ if ( accessibilityController.focusedElement.description == "AXDescription: Reply Item Five" ) {
result.innerText = "Passed";
}
else {
- result.innerText = "Failed. Result ==" + accessibilityController.focusedElement.title + "==";
+ result.innerText = "Failed. Result ==" + accessibilityController.focusedElement.description + "==";
}
}
</script>
Modified: trunk/LayoutTests/platform/mac/accessibility/aria-labelledby-on-input-expected.txt (89203 => 89204)
--- trunk/LayoutTests/platform/mac/accessibility/aria-labelledby-on-input-expected.txt 2011-06-18 20:18:04 UTC (rev 89203)
+++ trunk/LayoutTests/platform/mac/accessibility/aria-labelledby-on-input-expected.txt 2011-06-18 20:27:31 UTC (rev 89204)
@@ -1,3 +1,3 @@
This computer will self-destruct in minutes.
-The accessibility title is "AXTitle: This computer will self-destruct in 10 minutes."
+The accessibility description is "AXDescription: This computer will self-destruct in 10 minutes."
Modified: trunk/Source/WebCore/ChangeLog (89203 => 89204)
--- trunk/Source/WebCore/ChangeLog 2011-06-18 20:18:04 UTC (rev 89203)
+++ trunk/Source/WebCore/ChangeLog 2011-06-18 20:27:31 UTC (rev 89204)
@@ -1,3 +1,16 @@
+2011-06-18 Alice Boxhall <[email protected]>
+
+ Reviewed by Chris Fleizach.
+
+ Accessibility description for an element should make use of aria-labelledby.
+ https://bugs.webkit.org/show_bug.cgi?id=61995
+
+ Tests: accessibility/aria-labelledby-overrides-aria-label.html
+
+ * accessibility/AccessibilityRenderObject.cpp:
+ (WebCore::AccessibilityRenderObject::title): Don't return value from aria-labelledby.
+ (WebCore::AccessibilityRenderObject::ariaAccessibilityDescription): Return value from aria-labelledby in preference to value from aria-label.
+
2011-06-18 Christoph Mende <[email protected]>
Reviewed by Darin Adler.
Modified: trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp (89203 => 89204)
--- trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp 2011-06-18 20:18:04 UTC (rev 89203)
+++ trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp 2011-06-18 20:27:31 UTC (rev 89204)
@@ -1305,10 +1305,6 @@
if (!node)
return String();
- String ariaLabel = ariaLabeledByAttribute();
- if (!ariaLabel.isEmpty())
- return ariaLabel;
-
const AtomicString& title = getAttribute(titleAttr);
if (!title.isEmpty())
return title;
@@ -1351,6 +1347,10 @@
String AccessibilityRenderObject::ariaAccessibilityDescription() const
{
+ const AtomicString& ariaLabeledBy = ariaLabeledByAttribute();
+ if (!ariaLabeledBy.isEmpty())
+ return ariaLabeledBy;
+
const AtomicString& ariaLabel = getAttribute(aria_labelAttr);
if (!ariaLabel.isEmpty())
return ariaLabel;