-
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: AccessibilityText is not updated when static text descendant changes https://bugs.webkit.org/show_bug.cgi?id=270356 rdar://123741292 Reviewed by Chris Fleizach. Add a new TextUnderElementChanged notification to represent this scenario so we can make precise updates to the isolated tree. * LayoutTests/accessibility/dynamic-text-expected.txt: Added. * LayoutTests/accessibility/dynamic-text.html: Added. * LayoutTests/platform/ios/accessibility/dynamic-text-expected.txt: Added. * LayoutTests/platform/ios/TestExpectations: Enable new test. * Source/WebCore/accessibility/AXCoreObject.h: * Source/WebCore/accessibility/AXLogger.cpp: (WebCore::operator<<): * Source/WebCore/accessibility/AXObjectCache.cpp: (WebCore::AXObjectCache::handleTextChanged): (WebCore::AXObjectCache::updateIsolatedTree): * Source/WebCore/accessibility/AXObjectCache.h: * Source/WebCore/accessibility/AccessibilityNodeObject.cpp: (WebCore::AccessibilityNodeObject::visibleText const): * Source/WebCore/accessibility/AccessibilityObject.cpp: (WebCore::AccessibilityObject::dependsOnTextUnderElement const): * Source/WebCore/accessibility/AccessibilityObject.h: * Source/WebCore/accessibility/isolatedtree/AXIsolatedTree.cpp: (WebCore::AXIsolatedTree::updateNodeProperties): (WebCore::AXIsolatedTree::updateDependentProperties): * Source/WebCore/accessibility/isolatedtree/AXIsolatedTree.h: (WebCore::AXIsolatedTree::updateNodeProperty): Canonical link: https://commits.webkit.org/275693@main Identifier: 272448.800@safari-7618-branch
- Loading branch information
Dan Robson
committed
Mar 26, 2024
1 parent
1f9ed5f
commit 8687d2f
Showing
14 changed files
with
255 additions
and
51 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,36 @@ | ||
This test ensures we update the accessibility tree when static text changes. | ||
|
||
PASS: webarea.childAtIndex(0).role.toLowerCase().includes('text') === true | ||
AXValue: Initial static text | ||
|
||
#button text alternatives: | ||
AXTitle: Initial button text | ||
AXDescription: | ||
AXHelp: | ||
|
||
PASS: accessibilityController.accessibleElementById('label').stringValue.includes('Initial label text') === true | ||
#checkbox text alternatives: | ||
AXTitle: Initial label text | ||
AXDescription: | ||
AXHelp: | ||
|
||
PASS: accessibilityController.accessibleElementById('textarea').stringValue.includes('Initial textarea text') === true | ||
|
||
#button text alternatives: | ||
AXTitle: Changed button text | ||
AXDescription: | ||
AXHelp: | ||
|
||
PASS: webarea.childAtIndex(0).stringValue.includes('Changed static text') === true | ||
PASS: accessibilityController.accessibleElementById('label').stringValue.includes('Changed label text') === true | ||
#checkbox text alternatives: | ||
AXTitle: Changed label text | ||
AXDescription: | ||
AXHelp: | ||
|
||
PASS: accessibilityController.accessibleElementById('textarea').stringValue.includes('Changed textarea text') === true | ||
|
||
PASS successfullyParsed is true | ||
|
||
TEST COMPLETE | ||
Changed static textChanged button text Changed label text |
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,77 @@ | ||
<!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> | ||
Initial static text | ||
<button id="button">Initial button text</button> | ||
<label id="label" for="checkbox">Initial label text</label> | ||
<input id="checkbox" type="checkbox" name="checkbox" /> | ||
<textarea id="textarea">Initial textarea text</textarea> | ||
|
||
<script> | ||
var output = "This test ensures we update the accessibility tree when static text changes.\n\n"; | ||
|
||
function textAlternatives(id) { | ||
let result = ''; | ||
result += `#${id} text alternatives:\n` | ||
result += `${platformTextAlternatives(accessibilityController.accessibleElementById(id))}\n\n`; | ||
return result; | ||
} | ||
|
||
if (window.accessibilityController) { | ||
window.jsTestIsAsync = true; | ||
const isIOS = accessibilityController.platformName === "ios"; | ||
|
||
var webarea = accessibilityController.rootElement.childAtIndex(0); | ||
if (accessibilityController.platformName === "mac") { | ||
// Static text stringValue. | ||
output += expect("webarea.childAtIndex(0).role.toLowerCase().includes('text')", "true"); | ||
output += `${webarea.childAtIndex(0).stringValue}\n\n`; | ||
} | ||
|
||
output += textAlternatives("button"); | ||
|
||
if (!isIOS) | ||
output += expect("accessibilityController.accessibleElementById('label').stringValue.includes('Initial label text')", "true"); | ||
|
||
// Labelled control title. | ||
output += textAlternatives("checkbox"); | ||
|
||
// Textarea stringValue. | ||
output += expect("accessibilityController.accessibleElementById('textarea').stringValue.includes('Initial textarea text')", "true"); | ||
output += "\n"; | ||
|
||
document.getElementById("button").firstChild.nodeValue = "Changed button text"; | ||
setTimeout(async function() { | ||
let newPlatformText; | ||
await waitFor(() => { | ||
newPlatformText = textAlternatives("button"); | ||
return newPlatformText.includes("Changed button text"); | ||
}); | ||
output += newPlatformText; | ||
|
||
|
||
if (!isIOS) { | ||
document.getElementsByTagName("body")[0].firstChild.nodeValue = "Changed static text"; | ||
output += await expectAsync("webarea.childAtIndex(0).stringValue.includes('Changed static text')", "true"); | ||
} | ||
|
||
document.getElementById("label").firstChild.nodeValue = "Changed label text"; | ||
if (!isIOS) | ||
output += await expectAsync("accessibilityController.accessibleElementById('label').stringValue.includes('Changed label text')", "true"); | ||
output += textAlternatives("checkbox"); | ||
|
||
document.getElementById("textarea").firstChild.nodeValue = "Changed textarea text"; | ||
output += await expectAsync("accessibilityController.accessibleElementById('textarea').stringValue.includes('Changed textarea text')", "true"); | ||
|
||
debug(output); | ||
finishJSTest(); | ||
}, 0); | ||
} | ||
</script> | ||
</body> | ||
</html> | ||
|
29 changes: 29 additions & 0 deletions
29
LayoutTests/platform/glib/accessibility/dynamic-text-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,29 @@ | ||
This test ensures we update the accessibility tree when static text changes. | ||
|
||
#button text alternatives: | ||
AXTitle: Initial button text | ||
AXDescription: | ||
|
||
PASS: accessibilityController.accessibleElementById('label').stringValue.includes('Initial label text') === true | ||
#checkbox text alternatives: | ||
AXTitle: Initial label text | ||
AXDescription: | ||
|
||
PASS: accessibilityController.accessibleElementById('textarea').stringValue.includes('Initial textarea text') === true | ||
|
||
#button text alternatives: | ||
AXTitle: Changed button text | ||
AXDescription: | ||
|
||
PASS: webarea.childAtIndex(0).stringValue.includes('Changed static text') === true | ||
PASS: accessibilityController.accessibleElementById('label').stringValue.includes('Changed label text') === true | ||
#checkbox text alternatives: | ||
AXTitle: Changed label text | ||
AXDescription: | ||
|
||
PASS: accessibilityController.accessibleElementById('textarea').stringValue.includes('Changed textarea text') === true | ||
|
||
PASS successfullyParsed is true | ||
|
||
TEST COMPLETE | ||
Changed static textChanged button text Changed label text |
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
22 changes: 22 additions & 0 deletions
22
LayoutTests/platform/ios/accessibility/dynamic-text-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,22 @@ | ||
This test ensures we update the accessibility tree when static text changes. | ||
|
||
#button text alternatives: | ||
AXLabel: Initial button text | ||
|
||
#checkbox text alternatives: | ||
AXLabel: Initial label text | ||
|
||
PASS: accessibilityController.accessibleElementById('textarea').stringValue.includes('Initial textarea text') === true | ||
|
||
#button text alternatives: | ||
AXLabel: Changed button text | ||
|
||
#checkbox text alternatives: | ||
AXLabel: Changed label text | ||
|
||
PASS: accessibilityController.accessibleElementById('textarea').stringValue.includes('Changed textarea text') === true | ||
|
||
PASS successfullyParsed is true | ||
|
||
TEST COMPLETE | ||
Initial static text Changed button text Changed label text |
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
Oops, something went wrong.