Open forwardever opened 5 years ago
click triggers focusout event (on demo page)
Interesting. :/
Thanks for reporting this. The way the date picker is currently implemented, the focus event across platforms causes a lot of headaches. I have a better solution, but I don't think it'll be a small change. It's probably something that could be worked around with more hacks, but I'm not sure.
I'll happily accept a PR on this, but I'm not sure when I'll have the time to sit down and take a look. Right now, my side-project time is very compressed. I'm going to try to put all of it into getting a v3 out the door that solves this in a non-hacky way.
I can confirm, it's a tough one because it makes the range picker really tricky to use on iOS. Unfortunately I can also extend this ticket to include Firefox as well.
I have come up with a quick & dirty fix that works for me on Chrome / FF / Safari :
container.addEventListener('mousedown', function(evt) {
evt.preventDefault();
evt.stopPropagation();
return false;
});
where container is an element containing the calendars. Basically the idea is to catch the mousedown event (cancellable) instead of the focusout one (not cancellable).
Hopefully I'll have some time to create a clean PR on that one... In the meantime, hope this helps.
clicking next or previous month buttons in Safari closes the range picker, range picker also closes when a start date has been selected, so you have to reopen the window to enter an end date (on you demo page).
problems just show up in Safari, everything seems to work in Chrome, Firefox and Edge