Skip to content
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

Improve touch support #569

Open
emwee opened this issue Aug 8, 2016 · 6 comments
Open

Improve touch support #569

emwee opened this issue Aug 8, 2016 · 6 comments

Comments

@emwee
Copy link

emwee commented Aug 8, 2016

Hi,

Swiping the datepicker (because I want to scroll past it) causes the day (read: date cell) I happened to touch to swipe, to be selected. This is because swiping triggers a mousedown event.

I'm not quite sure why the mousedown event was chosen over the mouseup event, but right now this is causing usability issues for me on mobile.

Could the event be easily replaced? Or perhaps it is possible to detect a touch event, in which case the date selection can be prevented?

Thanks in advance!

@emwee
Copy link
Author

emwee commented Aug 15, 2016

No one?

Please note I am using the inline datepicker.

Edit: my assumption was wrong. The 'touchend' event causes the date to be selected, not the 'mousedown' event. Removing the 'touchend' event fixes the swiping issue on mobile when the datepicker is displayed inline, but prevents the date from being selected when binding the datepicker to an input field.

@kulte
Copy link

kulte commented Jan 30, 2017

Srsly how has no one responded to this!?!?!?!?

@epylinkn
Copy link

epylinkn commented Feb 4, 2017

In case anyone else is trying to figure this out, this worked for me on Pikaday 1.5.1 with a non-bound datepicker:

      var picker = new Pikaday({
        field: document.querySelector("#datepicker"),
        bound: false,
        container: document.querySelector("#datepicker-container"),
        onOpen: function () {
          if (!!window.removeEventListener) {
            this.el.removeEventListener("touchend", this._onMouseDown, true);
          } else {
            this.el.detachEvent('on' + "touchend", this._onMouseDown);
          }
        }
      });

@ravipunjwani
Copy link

Is there any other workaround for having tap events select the dates, but still allow swiping the screen to scroll without selecting the dates?

@wojciechczerniak
Copy link
Collaborator

Linked PR #397

@ronyrosenberg
Copy link

Still experiencing on mobile the jumping of 2 months.

Any updates re: this?
Thanks

@live627 live627 mentioned this issue Aug 5, 2022
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants