Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reach Dialog: add support for noIsolation option from react-remove-scroll #981

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 12 additions & 0 deletions packages/dialog/src/reach-dialog.tsx
Expand Up @@ -116,6 +116,7 @@ const DialogInner = React.forwardRef(function DialogInner(
onKeyDown,
onMouseDown,
unstable_lockFocusAcrossFrames,
disableEventCapturing,
...props
},
forwardedRef
Expand Down Expand Up @@ -188,6 +189,7 @@ const DialogInner = React.forwardRef(function DialogInner(
? !dangerouslyBypassScrollLock
: isOpen
}
noIsolation={disableEventCapturing}
>
<Comp
{...props}
Expand Down Expand Up @@ -429,6 +431,16 @@ interface DialogProps {
* @deprecated
*/
unstable_lockFocusAcrossFrames?: boolean;

/**
* By default, when the dialog is open, outer events are captured (see
* `noIsolation` option in react-remove-scroll:
* https://github.com/theKashey/react-remove-scroll#usage). Event capturing
* is React friendly and unlikely be a problem. But if you are rendering
* inside a shadow DOM container, you may want to disable event capturing.
*
*/
disableEventCapturing?: boolean;
}

Dialog.displayName = "Dialog";
Expand Down