Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
AX: Focusable elements without a role should not be ignored
https://bugs.webkit.org/show_bug.cgi?id=94302 Reviewed by Chris Fleizach. Source/WebCore: Changes the accessibility logic so that a generic element that's focusable is not ignored for accessibility, and returns its inner text as its title. That way if you Tab to the element, a reasonable accessibility notification is generated. One exception is the body element, because focusing the body is equivalent to blurring the current focused element and does not result in a "focus" accessibility notification. Also fixes logic that determined if an element was contentEditable by making sure it catches the case with no attribute value (e.g. <div contentEditable>), which also implies contentEditable=true according to the spec. Test: accessibility/focusable-div.html * accessibility/AccessibilityRenderObject.cpp: (WebCore): (WebCore::nodeHasContentEditableAttributeSet): (WebCore::AccessibilityRenderObject::title): (WebCore::AccessibilityRenderObject::accessibilityIsIgnored): LayoutTests: Adds a new test to make sure that a generic focusable element (like a div with tabindex=0) can get focus and return an appropriate title, just like a form control or element with an ARIA role. Modifies three existing tests that were previously assuming that a focusable node with no role would be ignored for accessibility ("accessibilityIsIgnored"). * accessibility/editable-webarea-context-menu-point.html: * accessibility/focusable-div-expected.txt: Added. * accessibility/focusable-div.html: Added. * accessibility/table-detection.html: * platform/mac/accessibility/listbox-hit-test.html: Canonical link: https://commits.webkit.org/112620@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@126391 268f45cc-cd09-0410-ab3c-d52691b4dbfc
- Loading branch information
Dominic Mazzoni
committed
Aug 23, 2012
1 parent
5a01726
commit ceb85ec5dcce1cf8ce98e6035f81092852e2dbfa
Showing
13 changed files
with
186 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -0,0 +1,20 @@ | ||
A | ||
B | ||
C | ||
This test makes sure that a generic focusable div can get accessibility focus. | ||
|
||
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 document.activeElement == div2 is true | ||
PASS lastChar(axDiv2.title) is "C" | ||
PASS document.activeElement == div3 is true | ||
PASS lastChar(axDiv3.description) is "D" | ||
PASS successfullyParsed is true | ||
|
||
TEST COMPLETE | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -0,0 +1,51 @@ | ||
<!DOCTYPE HTML> | ||
<html> | ||
<body> | ||
<script src="../fast/js/resources/js-test-pre.js"></script> | ||
|
||
<a id="link" href="#">A</a> | ||
<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> | ||
|
||
<div id="console"></div> | ||
<script> | ||
description("This test makes sure that a generic focusable div can get accessibility focus."); | ||
|
||
if (window.testRunner && window.accessibilityController) { | ||
window.testRunner.dumpAsText(); | ||
|
||
function lastChar(str) { | ||
return str.substr(str.length - 1); | ||
} | ||
|
||
var link = document.getElementById('link'); | ||
link.focus(); | ||
shouldBe("document.activeElement == link", "true"); | ||
window.axLink = accessibilityController.focusedElement; | ||
shouldBe("lastChar(axLink.title)", "\"A\""); | ||
|
||
var div = document.getElementById('div'); | ||
div.focus(); | ||
shouldBe("document.activeElement == div", "true"); | ||
window.axDiv = accessibilityController.focusedElement; | ||
shouldBe("lastChar(axDiv.title)", "\"B\""); | ||
|
||
var div2 = document.getElementById('div2'); | ||
div2.focus(); | ||
shouldBe("document.activeElement == div2", "true"); | ||
window.axDiv2 = accessibilityController.focusedElement; | ||
shouldBe("lastChar(axDiv2.title)", "\"C\""); | ||
|
||
var div3 = document.getElementById('div3'); | ||
div3.focus(); | ||
shouldBe("document.activeElement == div3", "true"); | ||
window.axDiv3 = accessibilityController.focusedElement; | ||
shouldBe("lastChar(axDiv3.description)", "\"D\""); | ||
} | ||
|
||
</script> | ||
|
||
<script src="../fast/js/resources/js-test-post.js"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters