Skip to content

Commit e2f1c3b

Browse files
fix: Uncaught Error: document is not defined for SSR (#7926) (#7927)
Fix error when window is set but document is undefined when running SSR. Co-authored-by: Robert Snow <[email protected]>
1 parent 4e845e7 commit e2f1c3b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

packages/@react-aria/interactions/src/useFocusVisible.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ function handleWindowBlur() {
123123
* Setup global event listeners to control when keyboard focus style should be visible.
124124
*/
125125
function setupGlobalFocusEvents(element?: HTMLElement | null) {
126-
if (typeof window === 'undefined' || hasSetupGlobalListeners.get(getOwnerWindow(element))) {
126+
if (typeof window === 'undefined' || typeof document === 'undefined' || hasSetupGlobalListeners.get(getOwnerWindow(element))) {
127127
return;
128128
}
129129

0 commit comments

Comments
 (0)