-
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: Table accessibility text does not update when its caption dynamic…
…ally changes it descendant text or is removed https://bugs.webkit.org/show_bug.cgi?id=273456 rdar://127263464 Reviewed by Chris Fleizach. When the descendants of caption elements change, we need to update the accessibility text of the associated table, as tables use the caption as a type of label. * LayoutTests/accessibility/dynamic-table-caption-expected.txt: Added. * LayoutTests/accessibility/dynamic-table-caption.html: Added. * Source/WebCore/accessibility/AXObjectCache.cpp: (WebCore::AXObjectCache::handleChildrenChanged): Canonical link: https://commits.webkit.org/278164@main
- Loading branch information
Showing
4 changed files
with
135 additions
and
0 deletions.
There are no files selected for viewing
26 changes: 26 additions & 0 deletions
26
LayoutTests/accessibility/dynamic-table-caption-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 we maintain the right accessibility text for tables after dynamic caption changes. | ||
|
||
AXTitle: Initial caption | ||
AXDescription: | ||
AXHelp: | ||
PASS: text.includes('Initial caption') === true | ||
AXTitle: Second caption | ||
AXDescription: | ||
AXHelp: | ||
PASS: text.includes('Second caption') === true | ||
AXTitle: | ||
AXDescription: | ||
AXHelp: | ||
PASS: !text.includes('caption') === true | ||
AXTitle: Final caption | ||
AXDescription: | ||
AXHelp: | ||
PASS: text.includes('Final caption') === true | ||
|
||
PASS successfullyParsed is true | ||
|
||
TEST COMPLETE | ||
Final caption | ||
Author Title | ||
Stephen Hawking A Brief History of Time | ||
Carl Sagan Cosmos |
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,79 @@ | ||
<!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 id="body"> | ||
|
||
<table id="table"> | ||
<caption id="caption">Initial caption</caption> | ||
<thead> | ||
<tr> | ||
<th>Author</th> | ||
<th>Title</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<tr> | ||
<td>Stephen Hawking</td> | ||
<td>A Brief History of Time</td> | ||
</tr> | ||
<tr> | ||
<td>Carl Sagan</td> | ||
<td>Cosmos</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
|
||
<script> | ||
var output = "This test ensures we maintain the right accessibility text for tables after dynamic caption changes.\n\n"; | ||
|
||
if (window.accessibilityController) { | ||
window.jsTestIsAsync = true; | ||
|
||
var table = accessibilityController.accessibleElementById("table"); | ||
var text = platformTextAlternatives(table); | ||
output += `${text}\n`; | ||
output += expect("text.includes('Initial caption')", "true"); | ||
|
||
setTimeout(async function() { | ||
// Wait for page updates caused by initial load to settle down so we don't pass the test by accident. | ||
await sleep(20); | ||
document.getElementById("caption").innerText = "Second caption"; | ||
|
||
await waitFor(() => { | ||
text = platformTextAlternatives(table); | ||
return text.includes("Second caption"); | ||
}); | ||
output += `${text}\n`; | ||
output += expect("text.includes('Second caption')", "true"); | ||
|
||
document.getElementById("body").appendChild(document.getElementById("caption")); | ||
document.getElementById("caption").innerText = "Final caption"; | ||
|
||
await waitFor(() => { | ||
text = platformTextAlternatives(table); | ||
return !text.includes("caption"); | ||
}); | ||
output += `${text}\n`; | ||
output += expect("!text.includes('caption')", "true"); | ||
|
||
let domTable = document.getElementById("table"); | ||
domTable.insertBefore(document.getElementById("caption"), domTable.firstElementChild); | ||
|
||
await waitFor(() => { | ||
text = platformTextAlternatives(table); | ||
return text.includes("Final caption"); | ||
}); | ||
output += `${text}\n`; | ||
output += expect("text.includes('Final caption')", "true"); | ||
|
||
debug(output); | ||
finishJSTest(); | ||
}, 0); | ||
} | ||
</script> | ||
</body> | ||
</html> | ||
|
22 changes: 22 additions & 0 deletions
22
LayoutTests/platform/glib/accessibility/dynamic-table-caption-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 maintain the right accessibility text for tables after dynamic caption changes. | ||
|
||
AXTitle: Initial caption | ||
AXDescription: | ||
PASS: text.includes('Initial caption') === true | ||
AXTitle: Second caption | ||
AXDescription: | ||
PASS: text.includes('Second caption') === true | ||
AXTitle: | ||
AXDescription: | ||
PASS: !text.includes('caption') === true | ||
AXTitle: Final caption | ||
AXDescription: | ||
PASS: text.includes('Final caption') === true | ||
|
||
PASS successfullyParsed is true | ||
|
||
TEST COMPLETE | ||
Final caption | ||
Author Title | ||
Stephen Hawking A Brief History of Time | ||
Carl Sagan Cosmos |
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