Why is the Popover modal by default? #3802
-
Hi! First of all, I want to thank you for the amazing work you are doing! We are using I am currently building a Popover component using usePopover and wondered why the popover is modal by default.
I can also see, that most of your pickers are modal (such as https://react-spectrum.adobe.com/react-spectrum/Picker.html) which seems a little bit unusual. I can make the popover non-modal by using the Would you be able to clarify this for me? Thank you so much! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 12 replies
-
The reasons are mostly related to React portals.
We strongly recommend against this, because it will cause problems for screen reader users as described in (1) above. ComboBox is an example of a component that specifically handles this case. It hides all elements except both the overlay and the input, since the user's focus remains on the input while the popover is open. The user also needs to interact with the input (e.g. moving the cursor) while the menu is open, so we don't prevent clicking outside in this case. We are also forced to close the menu on scroll in this case to avoid the other issues described above. Hopefully this clarifies the behavior. If you do have a case where scrolling or interaction outside a popover is expected, you can always drop down to the lower level hooks that |
Beta Was this translation helpful? Give feedback.
-
I’d also think scrolling behind a popover should be par for the course, and I can’t help but point out the irony of the GitHub comments interface itself exhibiting this behavior: ScreenRecording_01-17-2025.18-13-01_1.movThat said, I appreciate that the React Aria team is grappling with genuine tradeoffs, and that the option of dropping down to the lower level hooks is reasonable. |
Beta Was this translation helpful? Give feedback.
The reasons are mostly related to React portals.
<select>
for example, yo…