A drawer component for React.
fix: Fix non-modal drawers without overlay to properly set body pointer events (#460)
Kajetan Szymczak995e36a9d8a7
diff --git a/src/index.tsx b/src/index.tsxindex bb60332..7d78d7c 100644--- a/src/index.tsx+++ b/src/index.tsx@@ -718,6 +718,15 @@ export function Root({}}+ React.useEffect(() => {+ if (!modal) {+ // Need to do this manually unfortunately+ window.requestAnimationFrame(() => {+ document.body.style.pointerEvents = 'auto';+ });+ }+ }, [modal]);+return (<DialogPrimitive.RootdefaultOpen={defaultOpen}@@ -778,13 +787,6 @@ export const Overlay = React.forwardRef<HTMLDivElement, React.ComponentPropsWith// Overlay is the component that is locking scroll, removing it will unlock the scroll without having to dig into Radix's Dialog libraryif (!modal) {- // Need to do this manually unfortunately- if (typeof window !== 'undefined') {- window.requestAnimationFrame(() => {- document.body.style.pointerEvents = 'auto';- });- }-return null;}