Skip to content
This repository was archived by the owner on Sep 22, 2022. It is now read-only.

Commit 5cad252

Browse files
authored
Merge pull request #57 from github/root
Fix getRootNode not available in Edge 18
2 parents 0cea228 + 4d2b630 commit 5cad252

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ function toggle(event: Event): void {
100100
if (!(dialog instanceof DetailsDialogElement)) return
101101

102102
if (details.hasAttribute('open')) {
103-
const root = dialog.getRootNode() as Document | ShadowRoot
103+
const root = 'getRootNode' in dialog ? (dialog.getRootNode() as Document | ShadowRoot) : document
104104
if (root.activeElement instanceof HTMLElement) {
105105
initialized.set(dialog, {details, activeElement: root.activeElement})
106106
}

0 commit comments

Comments
 (0)