Merge pull request #15311 from Snuffleupagus/text-a11y-removed-element
Don't add `aria-owns` attributes for non-existent elements (PR 15237 follow-up)
This commit is contained in:
commit
2b66ed5fef
@ -97,6 +97,13 @@ class TextAccessibilityManager {
|
|||||||
// we restore them.
|
// we restore them.
|
||||||
const textChildren = this.#textChildren;
|
const textChildren = this.#textChildren;
|
||||||
for (const [id, nodeIndex] of this.#textNodes) {
|
for (const [id, nodeIndex] of this.#textNodes) {
|
||||||
|
const element = document.getElementById(id);
|
||||||
|
if (!element) {
|
||||||
|
// If the page was *fully* reset the element no longer exists, and it
|
||||||
|
// will be re-inserted later (i.e. when the annotationLayer renders).
|
||||||
|
this.#textNodes.delete(id);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
this.#addIdToAriaOwns(id, textChildren[nodeIndex]);
|
this.#addIdToAriaOwns(id, textChildren[nodeIndex]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user