Skip to content

armgit / vaul

Public Imported from GitHub
0

A drawer component for React.

fix: don't apply body styles if there's no wrapper (#426)

Emil Kowalskia7097a4c833a
diff --git a/src/use-scale-background.ts b/src/use-scale-background.ts
index 50b9d97..502de9c 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, {