-
Notifications
You must be signed in to change notification settings - Fork 1.2k
isNonModal
prop in <Popover />
(react-aria-components) is not working
#6819
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
Comments
isNonModal
prop in <Popover />
(react-aria-components) is not working
I think you're looking for this https://react-spectrum.adobe.com/react-aria/Modal.html#dismissable If you read the description of the prop you're trying to use, you'll notice it generally shouldn't be used as it can have a negative impact on accessibility. There are a few cases where it is appropriate, such as combobox, but there are not many of these situations. |
no, |
I do not quite follow. Are you building a combobox? or something else? The example I shared will close on click outside. If you want a popover that closes on click outside, they already do that without needing to specify anything https://react-spectrum.adobe.com/react-aria/Popover.html If the issue is that you want it to close when the user scrolls, we'd actually lie to determine how to get the combobox to also prevent scrolling and not close. That it closes right now is a bug #6609 |
I need just popover component to be closed when clicking outside when i pass isNonModal prop, i shared the code on general summary. |
@rafighajili Mind expanding on why you are trying to use the |
because by default, when i popover is opened, scrolling is being blocked. but when i pass isNonModal, i can scroll, and when i scroll, popover gets closed, which is expected result. but when i clock outside, it's not getting closed. |
I see, thank you for the additional information. The scrolling being blocked for Popovers is intentional, see #6070 (comment) for some additional links explaining the reasons for that. I would recommend you don't reach for |
Yeah got it, I also saw your point on documentation. But I have an exceptional case where popover should not block scrolling, and closes when I scroll, and when I click outside. That is why I used isNonModal prop. But on click outside doesn’t close popover. If you try the code that I wrote on general summary, you’ll see. |
I understand, but unfortunately for our library we don't support scrolling while a popover is open due to historical reasons laid out in #2926. The |
Provide a general summary of the issue here
🤔 Expected Behavior?
since there is
isNonModal
prop, it should close on scroll, or on click outside.😯 Current Behavior
it closes on scroll, but is not closing when clicking outside, or clicking button itself.
💁 Possible Solution
No response
🔦 Context
No response
🖥️ Steps to Reproduce
i used the code on documentation, https://react-spectrum.adobe.com/react-aria/Popover.html. just added
isNonModal
prop.Version
1.0.1
What browsers are you seeing the problem on?
Chrome
If other, please specify.
No response
What operating system are you using?
mac
🧢 Your Company/Team
No response
🕷 Tracking Issue
No response
The text was updated successfully, but these errors were encountered: