diff --git a/src/focus-trap.ts b/src/focus-trap.ts index 1e4a4b9..395c35b 100644 --- a/src/focus-trap.ts +++ b/src/focus-trap.ts @@ -34,8 +34,7 @@ function observeFocusTrap(container: HTMLElement, sentinels: HTMLElement[]) { const observer = new MutationObserver(mutations => { for (const mutation of mutations) { if (mutation.type === 'childList' && mutation.addedNodes.length) { - const sentinelChildren = Array.from( - mutation.addedNodes, + const sentinelChildren = Array.from(mutation.addedNodes).filter( e => e instanceof HTMLElement && e.classList.contains('sentinel') && e.tagName === 'SPAN', )