-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Uses React's onClick handler instead of OutsideClickHandler
with withPortal
implementations
#421
Conversation
…ithPortal` implementations This fixes an issue with Firefox specifically where the order of operations of the events caused the `withPortal` DayPicker to immediately close upon opening.
Do we want to do this unconditionally, or only when |
@ljharb If you look at where
which is what we want. |
1 similar comment
Is this an issue with OutsideClickHandler itself; or with our event handler not checking the event target properly? In other words, is this something we could solve while keeping OutsideClickHandler (even if this is a good hotfix in the interim)? |
@ljharb So I don't think it is specifically an issue with the Basically, here is what happens on Chrome:
Conversely, here is what happens in Firefox
Because the initial event is a (1) a focus event and (2) a react event, and the outside click event is (1) a click event and (2) a native JS event, I think there is some conflict between making them play nice together in this one weird edge case. I discussed this with @lencioni and I think this is the solution and not just a hotfix. |
Do you want to :stamp: me @ljharb? :D |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I kind of get your explanation, and I'm really nervous about adding an onClick
to a div instead of using our nice abstracted component; but your changes look fine.
Fix for #340
This fixes an issue with Firefox specifically where the order of operations of the events caused the
withPortal
DayPicker to immediately close upon opening.to: @lencioni
fyi: @phamcharles