-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
AX: NSApplicationAccessibilityFocusedUIElement is sometimes an ignore…
…d object which breaks functionality for Voice Control in Mail https://bugs.webkit.org/show_bug.cgi?id=260191 rdar://113689647 Reviewed by Andres Gonzalez. Mail uses WebPage::setEditable(true) (indirectly through IPC) to make the entire webpage of a Mail compose window be editable. One side-effect of this is that the `body` element gains focus. In https://bugs.webkit.org/show_bug.cgi?id=257739, we made the assumption that any focused object is inherently unignored by way of having focus, and removed this code from AXObjectCache::focusedObjectForNode: if (focus->accessibilityIsIgnored()) return focus->parentObjectUnignored(); This bug reveals two pieces of information: 1. Our assumption (any focused object is inherently unignored) is wrong, as the AXGroup associated with the `body` is ignored despite it being focused 2. Even if this assumption were true, we would still experience the bug, as Voice Control very specifically expects the web area to be focused when editing a Mail message (arguably a Voice Control bug that should be addressed later) With this patch, we restore the above check to AXObjectCache::focusedObjectForNode, restoring behavior for Voice Control. We may want to re-evaluate this again in the future, as our original assumption still seems sound but clearly has some kinks that need working out. * LayoutTests/accessibility/editable-webpage-focused-ui-element-expected.txt: Added. * LayoutTests/accessibility/editable-webpage-focused-ui-element.html: Added. * LayoutTests/platform/glib/TestExpectations: Disable new test. * LayoutTests/platform/ios/TestExpectations: Enable new test. * Source/WebCore/accessibility/AXObjectCache.cpp: (WebCore::AXObjectCache::focusedObjectForNode): * Source/WebCore/testing/Internals.cpp: (WebCore::Internals::setSelectionFromNone): * Source/WebCore/testing/Internals.h: * Source/WebCore/testing/Internals.idl: Canonical link: https://commits.webkit.org/266917@main
- Loading branch information
Showing
8 changed files
with
56 additions
and
0 deletions.
There are no files selected for viewing
9 changes: 9 additions & 0 deletions
9
LayoutTests/accessibility/editable-webpage-focused-ui-element-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,9 @@ | ||
This test ensures that the focused UI element is not an ignored element. | ||
|
||
internals.setSelectionFromNone(); | ||
PASS: accessibilityController.focusedElement.role.toLowerCase().includes('webarea') === true | ||
|
||
PASS successfullyParsed is true | ||
|
||
TEST COMPLETE | ||
|
34 changes: 34 additions & 0 deletions
34
LayoutTests/accessibility/editable-webpage-focused-ui-element.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<!DOCTYPE HTML> | ||
<html> | ||
<head> | ||
<script src="../resources/accessibility-helper.js"></script> | ||
<script src="../resources/js-test.js"></script> | ||
</head> | ||
<body dir="auto" style="overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;"> | ||
|
||
<script> | ||
var output = "This test ensures that the focused UI element is not an ignored element.\n\n"; | ||
|
||
// Note that ideally this test would use <!-- webkit-test-runner [ editable=true ] --> to simulate | ||
// a fully-editable webpage, i.e. in the style of Mail message bodies. However, there is a bug in | ||
// that option that prevents it from being set in the web process (it returns early in WebPageProxy::setEditable | ||
// because there is no running process to send the message to at the time the test options are processed). For now, | ||
// use Internals::setSelectionFromNone to force the <body> to be the focused element, as happens in WebPage::setEditable(true). | ||
|
||
if (window.accessibilityController) { | ||
window.jsTestIsAsync = true; | ||
|
||
output += evalAndReturn("internals.setSelectionFromNone();"); | ||
setTimeout(async function() { | ||
// Wait for focus to sync to the <body> and update the AX tree as a result of setSelectionFromNone(). | ||
await sleep(100); | ||
|
||
output += expect("accessibilityController.focusedElement.role.toLowerCase().includes('webarea')", "true"); | ||
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
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