Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
AX: Content within iframes with ARIA roles is not accessible
https://bugs.webkit.org/show_bug.cgi?id=259719 rdar://104611075 Reviewed by Chris Fleizach. This happened because `AccessibilityRenderObject::isAttachment` returned false for `RenderWidget`s associated with objects that have ARIA roles, which then caused `AccessibilityRenderObject::addAttachmentChildren()` to return early without inserting any of the iframe's content. This behavior (isAttachment returning false for things with an ARIA role) was added 15 years ago in commit: ca5f21d There is no test for this behavior, and I can't discern why it's necessary. So this patch removes it, in turn fixing the bug. * LayoutTests/accessibility/iframe-with-role-expected.txt: Added. * LayoutTests/accessibility/iframe-with-role.html: Added. * LayoutTests/platform/glib/TestExpectations: Skip new test. * LayoutTests/platform/ios/TestExpectations: Enable new test. * LayoutTests/platform/ios/accessibility/iframe-with-role-expected.txt: Added. * LayoutTests/platform/mac-wk1/accessibility/iframe-with-role-expected.txt: Added. * Source/WebCore/accessibility/AccessibilityRenderObject.cpp: (WebCore::AccessibilityRenderObject::isAttachment const): Canonical link: https://commits.webkit.org/266506@main
- Loading branch information
Showing
7 changed files
with
152 additions
and
8 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
This test ensures that the content within an iframe with an ARIA role is accessible. | ||
|
||
Traversing initial body content. | ||
|
||
AXRole: AXStaticText | ||
AXValue: Text before iframe | ||
|
||
AXRole: AXScrollArea | ||
|
||
AXRole: AXWebArea | ||
|
||
AXRole: AXButton | ||
|
||
AXRole: AXStaticText | ||
AXValue: Text after iframe | ||
|
||
document.getElementById('iframe').removeAttribute('role'); | ||
|
||
AXRole: AXStaticText | ||
AXValue: Text before iframe | ||
|
||
AXRole: AXScrollArea | ||
|
||
AXRole: AXWebArea | ||
|
||
AXRole: AXButton | ||
|
||
AXRole: AXStaticText | ||
AXValue: Text after iframe | ||
|
||
PASS successfullyParsed is true | ||
|
||
TEST COMPLETE | ||
Text before iframe Text after iframe |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> | ||
<html> | ||
<head> | ||
<script src="../resources/accessibility-helper.js"></script> | ||
<script src="../resources/js-test.js"></script> | ||
</head> | ||
<body onload="runTest()"> | ||
|
||
Text before iframe | ||
<iframe id="iframe" srcdoc="<body><button>Click me (inside iframe)</button></body>"></iframe> | ||
Text after iframe | ||
|
||
<script> | ||
window.jsTestIsAsync = true; | ||
|
||
var output = "This test ensures that the content within an iframe with an ARIA role is accessible.\n\n"; | ||
|
||
function traverseContent() { | ||
const rootWebArea = accessibilityController.rootElement.childAtIndex(0); | ||
let searchResult = null; | ||
while (true) { | ||
searchResult = rootWebArea.uiElementForSearchPredicate(searchResult, true, "AXAnyTypeSearchKey", "", false); | ||
if (!searchResult) | ||
break; | ||
|
||
const role = searchResult.role; | ||
output += `\n${role}`; | ||
if (role.includes("StaticText")) { | ||
let textContent = accessibilityController.platformName === "ios" ? searchResult.description : searchResult.stringValue; | ||
output += `\n${textContent}`; | ||
} | ||
output += "\n"; | ||
} | ||
} | ||
|
||
function runTest() { | ||
if (!window.accessibilityController) | ||
return; | ||
|
||
output += "Traversing initial body content.\n"; | ||
traverseContent(); | ||
|
||
output += `\n${evalAndReturn("document.getElementById('iframe').removeAttribute('role');")}`; | ||
setTimeout(async function() { | ||
// Wait an arbitrary amount of time for the AX tree to update. | ||
await sleep(100); | ||
traverseContent(); | ||
|
||
debug(output); | ||
finishJSTest(); | ||
}, 0); | ||
} | ||
</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
26 changes: 26 additions & 0 deletions
26
LayoutTests/platform/ios/accessibility/iframe-with-role-expected.txt
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
This test ensures that the content within an iframe with an ARIA role is accessible. | ||
|
||
Traversing initial body content. | ||
|
||
StaticText | ||
AXLabel: Text before iframe | ||
|
||
Button | ||
|
||
StaticText | ||
AXLabel: Text after iframe | ||
|
||
document.getElementById('iframe').removeAttribute('role'); | ||
|
||
StaticText | ||
AXLabel: Text before iframe | ||
|
||
Button | ||
|
||
StaticText | ||
AXLabel: Text after iframe | ||
|
||
PASS successfullyParsed is true | ||
|
||
TEST COMPLETE | ||
Text before iframe Text after iframe |
30 changes: 30 additions & 0 deletions
30
LayoutTests/platform/mac-wk1/accessibility/iframe-with-role-expected.txt
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
This test ensures that the content within an iframe with an ARIA role is accessible. | ||
|
||
Traversing initial body content. | ||
|
||
AXRole: AXStaticText | ||
AXValue: Text before iframe | ||
|
||
AXRole: AXWebArea | ||
|
||
AXRole: AXButton | ||
|
||
AXRole: AXStaticText | ||
AXValue: Text after iframe | ||
|
||
document.getElementById('iframe').removeAttribute('role'); | ||
|
||
AXRole: AXStaticText | ||
AXValue: Text before iframe | ||
|
||
AXRole: AXWebArea | ||
|
||
AXRole: AXButton | ||
|
||
AXRole: AXStaticText | ||
AXValue: Text after iframe | ||
|
||
PASS successfullyParsed is true | ||
|
||
TEST COMPLETE | ||
Text before iframe Text after iframe |
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