Commit 7f23b89a authored by cfleizach@apple.com's avatar cfleizach@apple.com

Source/WebCore: AX: Do not return an accessible name for an object just because it has tabindex=0

https://bugs.webkit.org/show_bug.cgi?id=126914

Reviewed by Mario Sanchez Prada.

WebKit has code to return an accessible name for any object that is "generically" focusable (ie. tabindex=0).
This behavior, which is not supported in ARIA, has caused many problems for VoiceOver. Often VoiceOver will
speak all the text underneath any type of group.

I think we need to revert this behavior and follow the ARIA spec more closely.

Test: accessibility/aria-describedby-ensures-visibility.html

* accessibility/AccessibilityNodeObject.cpp:
(WebCore::AccessibilityNodeObject::visibleText):
(WebCore::AccessibilityNodeObject::title):

LayoutTests: AX: WebKit concatenates name of all toolbar buttons in the apple.com video player
https://bugs.webkit.org/show_bug.cgi?id=126914

Reviewed by Mario Sanchez Prada.

* accessibility/focusable-div-expected.txt:
* accessibility/focusable-div.html:



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@162576 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 63ac2eb7
2014-01-22 Chris Fleizach <cfleizach@apple.com>
AX: WebKit concatenates name of all toolbar buttons in the apple.com video player
https://bugs.webkit.org/show_bug.cgi?id=126914
Reviewed by Mario Sanchez Prada.
* accessibility/focusable-div-expected.txt:
* accessibility/focusable-div.html:
2014-01-22 Dean Jackson <dino@apple.com>
Implement ANGLE_instanced_arrays
......@@ -6,7 +6,7 @@ Initial text before linkLink
List item
Initial text before list
List item
This test makes sure that a generic focusable div can get accessibility focus and gets its accessible text from contents..
This test makes sure that a generic focusable div can get accessibility focus. It should not get accessible text from its children automatically though.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
......@@ -14,21 +14,21 @@ On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE
PASS document.activeElement == link is true
PASS lastChar(axLink.title) is "A"
PASS document.activeElement == div is true
PASS lastChar(axDiv.title) is "B"
PASS lastChar(axDiv.title) is ' '
PASS document.activeElement == div2 is true
PASS lastChar(axDiv2.title) is "C"
PASS lastChar(axDiv2.title) is ' '
PASS document.activeElement == div3 is true
PASS lastChar(axDiv3.description) is "D"
PASS document.activeElement == div4 is true
PASS axDiv4.title.indexOf('Link') is -1
PASS document.activeElement == div5 is true
PASS axDiv5.title.indexOf('Link') is -1
PASS axDiv5.title.indexOf('Initial text before link') >= 0 is true
PASS axDiv5.title.indexOf('Initial text before link') >= 0 is false
PASS document.activeElement == div6 is true
PASS axDiv6.title.indexOf('List item') is -1
PASS document.activeElement == div7 is true
PASS axDiv7.title.indexOf('List item') is -1
PASS axDiv7.title.indexOf('Initial text before list') >= 0 is true
PASS axDiv7.title.indexOf('Initial text before list') >= 0 is false
PASS successfullyParsed is true
TEST COMPLETE
......
......@@ -6,7 +6,7 @@
<!-- A link always gets its accessible text from contents. -->
<a id="link" href="#">A</a>
<!-- A generic focusable div should also get its accessible text from contents. -->
<!-- A generic focusable div should not get its accessible text from contents. -->
<div id="div" tabindex="0">B</div>
<div id="div2" tabindex="0"><div></div>C</div>
<div id="div3" tabindex="0" aria-label="D"></div>
......@@ -19,7 +19,7 @@
<div id="console"></div>
<script>
description("This test makes sure that a generic focusable div can get accessibility focus and gets its accessible text from contents..");
description("This test makes sure that a generic focusable div can get accessibility focus. It should not get accessible text from its children automatically though.");
if (window.testRunner && window.accessibilityController) {
window.testRunner.dumpAsText();
......@@ -38,13 +38,13 @@ if (window.testRunner && window.accessibilityController) {
div.focus();
shouldBe("document.activeElement == div", "true");
window.axDiv = accessibilityController.focusedElement;
shouldBe("lastChar(axDiv.title)", "\"B\"");
shouldBe("lastChar(axDiv.title)", "' '");
var div2 = document.getElementById('div2');
div2.focus();
shouldBe("document.activeElement == div2", "true");
window.axDiv2 = accessibilityController.focusedElement;
shouldBe("lastChar(axDiv2.title)", "\"C\"");
shouldBe("lastChar(axDiv2.title)", "' '");
var div3 = document.getElementById('div3');
div3.focus();
......@@ -63,7 +63,7 @@ if (window.testRunner && window.accessibilityController) {
shouldBe("document.activeElement == div5", "true");
window.axDiv5 = accessibilityController.focusedElement;
shouldBe("axDiv5.title.indexOf('Link')", "-1");
shouldBe("axDiv5.title.indexOf('Initial text before link') >= 0", "true");
shouldBe("axDiv5.title.indexOf('Initial text before link') >= 0", "false");
var div6 = document.getElementById('div6');
div6.focus();
......@@ -76,7 +76,7 @@ if (window.testRunner && window.accessibilityController) {
shouldBe("document.activeElement == div7", "true");
window.axDiv7 = accessibilityController.focusedElement;
shouldBe("axDiv7.title.indexOf('List item')", "-1");
shouldBe("axDiv7.title.indexOf('Initial text before list') >= 0", "true");
shouldBe("axDiv7.title.indexOf('Initial text before list') >= 0", "false");
}
</script>
......
2014-01-22 Chris Fleizach <cfleizach@apple.com>
AX: Do not return an accessible name for an object just because it has tabindex=0
https://bugs.webkit.org/show_bug.cgi?id=126914
Reviewed by Mario Sanchez Prada.
WebKit has code to return an accessible name for any object that is "generically" focusable (ie. tabindex=0).
This behavior, which is not supported in ARIA, has caused many problems for VoiceOver. Often VoiceOver will
speak all the text underneath any type of group.
I think we need to revert this behavior and follow the ARIA spec more closely.
Test: accessibility/aria-describedby-ensures-visibility.html
* accessibility/AccessibilityNodeObject.cpp:
(WebCore::AccessibilityNodeObject::visibleText):
(WebCore::AccessibilityNodeObject::title):
2014-01-22 Brady Eidson <beidson@apple.com>
The IDB backing store get() method shouldn't call IDB callbacks directly
......@@ -1354,11 +1354,6 @@ void AccessibilityNodeObject::visibleText(Vector<AccessibilityText>& textOrder)
// the user as a single atomic object, so we should use its text as the default title.
if (isHeading() || isLink())
useTextUnderElement = true;
else if (isGenericFocusableElement()) {
// If a node uses a negative tabindex, do not expose it as a generic focusable element, because keyboard focus management
// will never land on this specific element.
useTextUnderElement = !(node && node->isElementNode() && toElement(node)->tabIndex() < 0);
}
if (useTextUnderElement) {
AccessibilityTextUnderElementMode mode;
......@@ -1733,18 +1728,6 @@ String AccessibilityNodeObject::title() const
if (isHeading())
return textUnderElement(AccessibilityTextUnderElementMode(AccessibilityTextUnderElementMode::TextUnderElementModeSkipIgnoredChildren, true));
// If it's focusable but it's not content editable or a known control type, then it will appear to
// the user as a single atomic object, so we should use its text as the default title.
if (isGenericFocusableElement()) {
// If a node uses a negative tabindex, do not expose it as a generic focusable element, because keyboard focus management
// will never land on this specific element.
Node* node = this->node();
if (node && node->isElementNode() && toElement(node)->tabIndex() < 0)
return String();
return textUnderElement();
}
return String();
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment