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
Command Palettes: Clicking near edges does not close modal #1216
Comments
Thanks for reporting — the reason for the current behavior is to prevent closing the dialog when the user clicks a scrollbar, because the browser doesn't give us any way to distinguish clicking a scrollbar from clicking the actual background. Super annoying but the example you gave makes sense and we'll see definitely look for a solution. |
Interesting that this is an affordance for scrolling, essentially. I think that typically (though certainly not always) the main page need not be scrolled while a modal is active. Still, do the top and left sides need this affordance since I don't think scrollbars ever go there. Perhaps this is not the case with RTL languages? |
The main situation where scrolling comes up is when you need to scroll because the modal contents are taller than the viewport, like this Bootstrap example: Untitled.movHeadless UI needs to kinda work for all of these cases which is why that happens. Agree that it sucks to hurt the 90% use case to support the 10% use case though. I think we can find ways to improve it 👍 |
Right, that's totally valid and important. I guess the way I was envisioning scrolling working in that case is that the scroll is inside the modal, but this is another way it could be implemented. |
@jdlien Hey! Just a heads up that I think we've solved this issue in Headless UI (tailwindlabs/headlessui#1546), and should have that released soon 👍 |
Thanks, Jonathan. It's so great to see Headless UI and your other products improving so rapidly. Thanks for taking my feedback seriously! |
What component (if applicable)
Describe the bug
Clicking outside of the modal for a command palette should close the modal. However, if you click very near the edges of the DialogOverlay, nothing happens.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
The modal dialog should transition out and disappear temporarily.
Browser/Device (if applicable)
Tested on Windows Chrome 101 and Firefox 100
Additional context
This problem also occurs on the headlessui.dev demo for modal dialogs, but does NOT occur in the TailwindUI modal example.
This is a usability problem because on mobile devices, this outer edge may be the only clickable area outside of the dialog, and that makes it difficult to close such dialogs.
The text was updated successfully, but these errors were encountered: