Skip to content

Commit 0d50ed9

Browse files
committed
feat: check for server before creating treewalker from document
1 parent 55b4650 commit 0d50ed9

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

dialog/internal/dialog.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,9 @@ export class Dialog extends dialogBaseClass {
150150
private escapePressedWithoutCancel = false;
151151
// This TreeWalker is used to walk through a dialog's children to find
152152
// focusable elements. TreeWalker is faster than `querySelectorAll('*')`.
153-
private readonly treewalker = document.createTreeWalker(
153+
// We check for isServer because there isn't a "document" during an SSR
154+
// run.
155+
private readonly treewalker = isServer ? {} : document.createTreeWalker(
154156
this,
155157
NodeFilter.SHOW_ELEMENT,
156158
);

0 commit comments

Comments
 (0)