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

[Dialog] Scrollable overlay closes Dialog when trying to scroll with the scrollbar #2872

Open
dimitur2204 opened this issue May 1, 2024 · 0 comments

Comments

@dimitur2204
Copy link

Bug report

Current Behavior

The problem occurs following the scrollable overlay example for the dialog here - https://www.radix-ui.com/primitives/docs/components/dialog#scrollable-overlay.
The styling is applied correctly and scrolling with scroll wheel, trackpad or slide gesture works as expected. However when scrolling by clicking the scrollbar on the right, it triggers the click outside listener and closes the dialog.

Expected behavior

Clicks over the scrollbar that appears should not close the Dialog.

Reproducible example

https://codesandbox.io/p/sandbox/elegant-ritchie-vhp3xp
You should click the "Open" and then reduce the height until the dialog overflows on the Y-axis, then try scrolling by clicking the scrollbar.

Suggested solution

What comes to mind to me is just doing custom logic for detection of clicks on the scrollbar in the click outside listener.
Note: I have not looked at code at all and have no idea of the internals and whether or not that is possible.

Your environment

Software Name(s) Version
Radix Package(s) @radix-ui/react-dialog 1.0.3
React n/a 16.13.1
Browser Google Chrome latest
Node n/a 18.0.0
pnpm n/a 8.14.3
Operating System Mac OS Sonoma 14.5
@dimitur2204 dimitur2204 changed the title [Dialog] Scrollable overlay closes when trying to scroll with the scrollbar [Dialog] Scrollable overlay closes Dialog when trying to scroll with the scrollbar May 1, 2024
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

1 participant