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

[Modal]: separate hide outside and prevent scroll behavior from modal prop of overlay components #206

Closed
fabien-ml opened this issue May 2, 2023 · 3 comments

Comments

@fabien-ml
Copy link
Collaborator

Is your feature request related to a problem? Please describe.
Separate hide outside and prevent scroll behaviors from modal prop of overlay components (Dialog, Popover, Menu, Select...)

Describe the solution you'd like
Split the modal prop in two props:

  • modal: aria-hide outside elements and disable pointer outside where needed.
  • preventScroll: lock body scroll.
@fabien-ml fabien-ml changed the title [Modal]: separate hide outside and prevent scroll behavior from modal prop of several components [Modal]: separate hide outside and prevent scroll behavior from modal prop of overlay components May 2, 2023
@katywings
Copy link

@fabien-ml Thank you for creating this 😊

@fabien-ml
Copy link
Collaborator Author

fabien-ml commented May 4, 2023

Most of the time the modal behavior should be what it is actually. Sine your use case is an edge case and to avoid breaking changes I'm thinking about doing it like this:

  • modal: stay the same
  • preventScroll: only prevent scroll.

In your component you disable the modal mode and only enable scroll lock:

<Dialog.Root modal={false} preventScroll />

Scroll will be lock if either one of the prop is true.

Also I don't think the other possible case, only wanting the "hide outside" and not the scroll lock is a valid use case tbh.

@katywings
Copy link

Most of the time the modal behavior should be what it is actually
Indeed.

I appreciate your detailed answer, ty! That preventScroll prop would help a lot. If you are interested I can create a PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants