зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1572317: When removing an Accessible because it lost its frame, remove Accessibles for DOM descendants as well. r=eeejay
Removing an Accessible removes descendants in the a11y tree. However, there may be DOM descendants which have been relocated elsewhere in the a11y tree. Their DOM nodes are now hidden as well, so we need to remove those Accessibles too. In addition to Accessibles remaining in the tree when they shouldn't, failing to remove relocated Accessibles caused problems later on when a relocated Accessible was shown with new descendants. Differential Revision: https://phabricator.services.mozilla.com/D41178 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
18a61c2721
Коммит
76dff37c45
|
@ -1326,9 +1326,12 @@ bool DocAccessible::PruneOrInsertSubtree(nsIContent* aRoot) {
|
|||
|
||||
nsIFrame* frame = acc->GetFrame();
|
||||
|
||||
// Accessible has no frame and its not display:contents. Remove it.
|
||||
// Accessible has no frame and it's not display:contents. Remove it.
|
||||
// As well as removing the a11y subtree, we must also remove Accessibles
|
||||
// for DOM descendants, since some of these might be relocated Accessibles
|
||||
// and their DOM nodes are now hidden as well.
|
||||
if (!frame && !nsCoreUtils::IsDisplayContents(aRoot)) {
|
||||
ContentRemoved(acc);
|
||||
ContentRemoved(aRoot);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -157,6 +157,32 @@
|
|||
] });
|
||||
}
|
||||
|
||||
// Test to ensure that relocated accessibles are removed when a DOM
|
||||
// ancestor is hidden.
|
||||
async function removeRelocatedWhenDomAncestorHidden() {
|
||||
info("removeRelocatedWhenDomAncestorHidden");
|
||||
|
||||
testAccessibleTree("c8",{ SECTION: [
|
||||
{ EDITCOMBOBOX: [ // c8_owner
|
||||
{ COMBOBOX_LIST: [] }, // c8_owned
|
||||
]},
|
||||
{ SECTION: [] }, // c8_owned_container
|
||||
] });
|
||||
|
||||
let events = waitForOrderedEvents([
|
||||
[EVENT_HIDE, "c8_owned_container"],
|
||||
[EVENT_HIDE, "c8_owned"],
|
||||
[EVENT_REORDER, "c8"],
|
||||
], "removeRelocatedWhenDomAncestorHidden");
|
||||
document.body.offsetTop; // Flush layout.
|
||||
getNode("c8_owned_container").hidden = true;
|
||||
await events;
|
||||
|
||||
testAccessibleTree("c8",{ SECTION: [
|
||||
{ EDITCOMBOBOX: [] }, // c8_owner
|
||||
] });
|
||||
}
|
||||
|
||||
async function doTest() {
|
||||
await hideDivFromInsideSpan();
|
||||
|
||||
|
@ -172,6 +198,8 @@
|
|||
|
||||
await intermediateNonAccessibleContainerBecomesAccessible();
|
||||
|
||||
await removeRelocatedWhenDomAncestorHidden();
|
||||
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
|
@ -214,6 +242,13 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div id="c8">
|
||||
<div id="c8_owner" role="combobox" aria-owns="c8_owned"></div>
|
||||
<div id="c8_owned_container">
|
||||
<div id="c8_owned" role="listbox"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="eventdump"></div>
|
||||
</body>
|
||||
</html>
|
||||
|
|
Загрузка…
Ссылка в новой задаче