Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/green-needles-jump.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@radix-ui/react-dialog": patch
---

Fix Dialog's RemoveScroll and disableOutsidePointerEvents work with forceMount
4 changes: 2 additions & 2 deletions packages/react/dialog/src/dialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ const DialogOverlayImpl = React.forwardRef<DialogOverlayImplElement, DialogOverl
return (
// Make sure `Content` is scrollable even when it doesn't live inside `RemoveScroll`
// ie. when `Overlay` and `Content` are siblings
<RemoveScroll as={Slot} allowPinchZoom shards={[context.contentRef]}>
<RemoveScroll enable={context.isOpen} as={Slot} allowPinchZoom shards={[context.contentRef]}>
<Primitive.div
data-state={getState(context.open)}
{...overlayProps}
Expand Down Expand Up @@ -275,7 +275,7 @@ const DialogContentModal = React.forwardRef<DialogContentTypeElement, DialogCont
// we make sure focus isn't trapped once `DialogContent` has been closed
// (closed !== unmounted when animating out)
trapFocus={context.open}
disableOutsidePointerEvents
disableOutsidePointerEvents={context.open}
onCloseAutoFocus={composeEventHandlers(props.onCloseAutoFocus, (event) => {
event.preventDefault();
context.triggerRef.current?.focus();
Expand Down