Open FranMusolino opened 1 month ago
have you tried the latest versions?
Yes, I tried with version @nextui-org/select@2.2.7 and @nextui-org/modal@2.0.41, same history
I tried on latest version and couldn't reproduce the issue. Can you share the sandbox?
Hi, unfortunately, I'm also affected by this issue. I've been unable to use a Select inside a Modal without issues because when I click on a Select's Option, then the modal just closes itself. I think it treats click on an Option as a click outside the Modal.
In addition to the author's solution that involves removing the onOpenChange
prop, I found another "fix" by setting Modal's isDismissible
prop to false
. But both solutions are not ideal, as I want to keep my Modals dismissible for better accessibility.
Would really love to see a fix to this bug. If needed, I can provide a reproducible sandbox.
I stumbled upon the same issue, but I have no idea when this regression came up. I tried to downgrade with no luck, but I'm pretty sure it wasn't the case when I first installed next ui a few months ago.
@domhhv please help provide a reproducible sandbox.
For some reason, it's hard to reproduce this issue in a code sandbox or even a clean local setup (modal with select just behaves normally).
But I still do observe this issue in my app and I can provide a reproducible example from there.
If you navigate to https://www.habitrack.io/habits, you'll be able to open two separate modals for adding a habit or editing a mock habit:
isDismissible={false}
.isDismissible={false}
and that's a fix I applied to all NextUI Modals in my app.This app is open-source and uses NextUI. Here's the GitHub repo. Code that renders those two modals can be viewed here (edit modal) and here (add modal). It should be quick to run the app locally if needed (no local db required, just the React app; refer to README.md).
Hopefully, this could work as a reproducible example. @wingkwong Let me know if you need help or if a different example is necessary.
Thanks!
For some reason, it's hard to reproduce this issue in a code sandbox or even a clean local setup (modal with select just behaves normally).
But I still do observe this issue in my app and I can provide a reproducible example from there.
If you navigate to https://www.habitrack.io/habits, you'll be able to open two separate modals for adding a habit or editing a mock habit:
- If you try selecting a mock trait within the edit modal, it will close. That modal doesn't apply
isDismissible={false}
.- If you try selecting a mock trait within the add modal, it won't close. That modal applies
isDismissible={false}
and that's a fix I applied to all NextUI Modals in my app.This app is open-source and uses NextUI. Here's the GitHub repo. Code that renders those two modals can be viewed here (edit modal) and here (add modal). It should be quick to run the app locally if needed (no local db required, just the React app; refer to README.md).
Hopefully, this could work as a reproducible example. @wingkwong Let me know if you need help or if a different example is necessary.
Thanks! it works
Hey @wingkwong. Did you have a chance to look into this? My links to those examples could become obsolete sooner or later.
(sorry, there was a regression after my commits yesterday and the app didn't load, fixed now)
NextUI Version
@nextui-org/select@2.2.5 and @nextui-org/modal@2.0.33
Describe the bug
If you use a Select inside a Modal component, selecting an item causes the modal to close automatically. I tried using e.stopPropagation() on several events of the Select component, such as onSelect or onChange, but it didn't work. The only way to prevent this behavior is by removing the following attribute from the Modal component
onOpenChange={(isOpen) => (isOpen ? onOpen() : onClose())}
Your Example Website or App
No response
Steps to Reproduce the Bug or Issue
The component which calls the modal is the following
Expected behavior
Modal automatically closes on item selection
Screenshots or Videos
No response
Operating System Version
Windows 11
Browser
Chrome