fix block strategy

If an element was blocked, its child nodes should also be blocked.
The interactions and mutations on the element and its child nodes
also need to be blocked.
This commit is contained in:
Yanzhen Yu
2026-04-01 12:00:00 +08:00
parent c603ff3b1e
commit e4cb91e1e6
5 changed files with 256 additions and 6 deletions

View File

@@ -112,3 +112,17 @@ export function getWindowWidth(): number {
(document.body && document.body.clientWidth)
);
}
const BLOCK_CLASS = 'rr-block';
export function isBlocked(node: Node | null): boolean {
if (!node) {
return false;
}
if (node.nodeType === node.ELEMENT_NODE) {
return (
(node as HTMLElement).classList.contains(BLOCK_CLASS) ||
isBlocked(node.parentNode)
);
}
return isBlocked(node.parentNode);
}