Skip to content

armgit / vaul

Public Imported from GitHub
0

A drawer component for React.

fix: make modal false scrollable (#444)

Emil Kowalskib8be89625d13
diff --git a/src/index.tsx b/src/index.tsx
index d820a27..1aa63dd 100644
--- a/src/index.tsx
+++ b/src/index.tsx
@@ -694,6 +694,9 @@ export const Overlay = React.forwardRef<HTMLDivElement, React.ComponentPropsWith
const composedRef = useComposedRefs(ref, overlayRef);
const hasSnapPoints = snapPoints && snapPoints.length > 0;
+ // Overlay is the component that is locking scroll, removing it will unlock the scroll without having to dig into Radix's Dialog library
+ if (!modal) return null;
+
return (
<DialogPrimitive.Overlay
onMouseUp={onRelease}
@@ -701,7 +704,6 @@ export const Overlay = React.forwardRef<HTMLDivElement, React.ComponentPropsWith
data-vaul-overlay=""
data-vaul-snap-points={isOpen && hasSnapPoints ? 'true' : 'false'}
data-vaul-snap-points-overlay={isOpen && shouldFade ? 'true' : 'false'}
- style={{ visibility: modal ? 'visible' : 'hidden' }}
{...rest}
/>
);