Skip to content

Commit bea378a

Browse files
committed
fix: Uncaught Error: document is not defined for SSR (adobe#7926)
Fix error when window is set but document is undefined when running SSR.
1 parent 1457ded commit bea378a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

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

+1-1
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)