If you open the SingleDatePicker and select a date, then go to a different app, and come back to the browser, and click anywhere on the page, the date picker re-opens even thought it wasn't set into focus itself.
This happens in the demo you have linked in the readme, so it's not specific to my implementation.
I'll look into fixing it myself next week if you don't get to it before me.
Huh, that's weird. Happens with the DateRangePicker as well.
Any updates on this @majapw ?
(We're always able to accept PRs though :) )
Thanks. I'll try and see if I can figure out the fix.
Sorry, I have been out of the country so I haven't been able to really dig into this. I might have some time this week, but likely it will have to wait until the following week.
Does this bug was already fixed?
It seem to fix it we need take out (or comment) //onFocus={onFocus} (line 120 in src/components/DateInput.jsx)
I can reproduce this bug on airbnb.com as well. I'm surprised it's not higher priority to fix this for you.
I agree @Valentin1918's fix is not ideal...
@jkudish it's being worked on as we speak.
It's not been a high priority because it doesn't actually block any functionality nor break anything, it's just an irritating extra click/tab to close the datepicker in the rare case when the last field focused was the date input, and you switch to another window, and switch back.
Understood. Glad you're working on it. I'm just circling back on it myself to see if there's a workaround.
I guess in my application it's a bit higher priority because of how we use it. We have it setup as a full screen date picker + a lot of tabbing in/out of that window because it's an internal project management app and users are often multi-tasking.
From @majapw and I's spelunking it seems like this is actual normal, expected browser behavior, so we're looking into implementing a workaround for this specific datepicker case - in other words, it's not a "bug" so much as an artifact of datepickers not being a well-integrated native UI, thus necessitating libraries like this :-)
Can you clarify what you mean by it being expected browser behavior? Now you've peaked my curiosity... 馃槈
BTW, I appreciate the work you've done with this and that it's open source, definitely saves us a lot of time, thank you! 馃槃
@jkudish PR incoming! :)