Skip to content

Commit

Permalink
Fix ReferenceError: process is not defined
Browse files Browse the repository at this point in the history
Added checks to ensure safe access to `process.env`, addressing environments where it might be undefined.
  • Loading branch information
kasperbirch1 committed Nov 10, 2023
1 parent fe04097 commit c0432ad
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/core/utils/modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,10 @@ function Modal({
<FocusTrap
focusTrapOptions={{
// Set fallbackFocus when running vitest to avoid focus trap errors.
fallbackFocus: process.env.VITEST ? "body" : undefined
fallbackFocus:
typeof process !== "undefined" && process.env && process.env.VITEST
? "body"
: undefined
}}
>
<div>
Expand Down

0 comments on commit c0432ad

Please sign in to comment.