diff --git a/src/use-scale-background.ts b/src/use-scale-background.ts index 50b9d97f..502de9cb 100644 --- a/src/use-scale-background.ts +++ b/src/use-scale-background.ts @@ -21,6 +21,8 @@ export function useScaleBackground() { (document.querySelector('[data-vaul-drawer-wrapper]') as HTMLElement) || (document.querySelector('[vaul-drawer-wrapper]') as HTMLElement); + if (!wrapper) return; + const bodyAndWrapperCleanup = chain( setBackgroundColorOnScale && !noBodyStyles ? assignStyle(document.body, { background: 'black' }) : noop, assignStyle(wrapper, {