-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
[v5] Popover doesn't close when clicked outside in React 18 StrictMode #6203
Comments
@adidahiya With |
@bioc-druzgami I'm not sure, it's an upstream bug in popper.js and it looks like the maintainer has not taken a look at the bugfix PR submitted by @PetrusAsikainen. If we don't get that PR merged, the other options for us are to either:
The latter option sounds like quite a big breaking change that I'm hesitant to take on any time soon given how painful it was to migrate Popover -> Popover2 in Blueprint v4.x for our very large code base. |
Actually, the third option which is our best path forward: remove our usage of |
I forked the original sandbox in this thread and updated to @blueprintjs/core v5.3.3, the issue is still present: https://codesandbox.io/p/sandbox/jovial-framework-75l4w4?file=%2Fpackage.json%3A16%2C5 |
Based on my testing the issue was in |
Perhaps this could be fixed by replacing |
I don't mean to spam this thread but merely as feedback for the library: this is also the only bug I am tracking which blocks my adoption of |
Since this was the last blocker for a project that was being upgraded to |
Thanks for the feedback folks, I've bumped the priority on this issue and I believe I've found a workaround that reverts Popover to its behavior before cfdcbd3 while still avoiding I think I switched to using react-popper's Bugfix PR here: #6458. Should land in a release this week if there are no issues in testing the change. |
Good news: I've verified that the bug is fixed in @blueprintjs/core v5.5.0 using the repro in @PetrusAsikainen's original code sandbox. Here's my forked sandbox: https://codesandbox.io/p/sandbox/gifted-ritchie-rmstyp?file=%2Fsrc%2Fmain.tsx%3A4%2C53 |
Note that React will still print console warnings in strict mode, since we still use |
tl;dr: Popovers with
interactionKind="click"
in v5 don't close when rendered within React 18 StrictMode and the user clicks outside the popover. This includes anything depending on Popover, like Select.This is an upstream bug in
react-popper
. Already filed a PR, but I'm also filing it here because I don't want anyone else to have to debug this. Only an uncommon use case ofreact-popper
(Reference
withinnerRef
) is affected but that breaks BlueprintJS's usage.floating-ui/react-popper#459
v4
andpopover2
are unaffected because they usefindDOMNode
instead ofinnerRef
.Environment
@blueprintjs/core@5.0.0-alpha.6
Code Sandbox
https://codesandbox.io/p/sandbox/tender-brown-wryqy4
Steps to reproduce
Actual behavior
The popover inside StrictMode doesn't close when you click outside the popover
Expected behavior
...it does?
The text was updated successfully, but these errors were encountered: