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

Issue with Apple Pencil #315

Open
andrewkendall opened this issue Apr 8, 2019 · 3 comments
Open

Issue with Apple Pencil #315

andrewkendall opened this issue Apr 8, 2019 · 3 comments

Comments

@andrewkendall
Copy link

There is currently an issue when using an Apple Pencil. Using the Apple Pencil always triggers a touchmove event, meaning the simulated click doesn't work as intended.

// If the touch interaction did not move, it should trigger a click
if (!this._touchMoved) {

  // Simulate the click event
  simulateMouseEvent(event, 'click');
}

A quick fix is to update the code to:

// If the touch interaction did not move, it should trigger a click
if (!this._touchMoved || event.originalEvent.changedTouches[0].touchType === 'stylus') {

  // Simulate the click event
  simulateMouseEvent(event, 'click');
}

Hopefully, that will help someone who is struggling with click events with the Apple Pencil. If anyone has a neater update to the code I'd love to know.

@andrewkendall
Copy link
Author

andrewkendall commented Apr 8, 2019

@RWAP you're doing great work folding in fixes, you might want to take a look at this one. It works better with your updated code as you are also watching for the amount of movement before triggering a click.

RWAP added a commit to RWAP/jquery-ui-touch-punch that referenced this issue Jun 3, 2019
This fixes the issue: furf#315 where the Apple Pencil triggers a touchmove event and you may struggle to trigger a click with the pencil
@RWAP
Copy link

RWAP commented Jun 3, 2019

@RWAP you're doing great work folding in fixes, you might want to take a look at this one. It works better with your updated code as you are also watching for the amount of movement before triggering a click.

Thanks - I have suggested a change - RWAP#3
Can you please verify my change - as I do not have an Apple device (let alone a Pencil!)

@andrewkendall
Copy link
Author

@RWAP I've just tested on iPad mini 5 and 12.9-inch iPad Pro. That works perfectly.

wbitholedotbe added a commit to wbitholedotbe/jquery-ui-touch-punch that referenced this issue Feb 19, 2021
* Updated to v1.0.0 to combine suggested changes

Combine suggested changes to take account of issues with the original jquery-ui-touch-punch.js which has not been updated since 2014 - https://github.com/furf/jquery-ui-touch-punch

* Update to cover why new fork created

* Removed change for zoomed devices

Lines dealing with "fix for zoomed devices while dragging" prevented jQuery ui sortable from moving items after you drag them to a new position

* Notes on jquery-ui dialog and close button

* Update for Apple Pencil

This fixes the issue: furf#315 where the Apple Pencil triggers a touchmove event and you may struggle to trigger a click with the pencil

* FIx #4 - mouse undefined

* Typo in last commit

* v1.0.3 Release - Change to handling of click events

Previous release had an issue where clicking through to an input or a button (for example the close button on jQuery.ui dialog boxes)  was not being recognised as a click.  Incorporated another fix from the v0.2.3 branch so the code now treats anything as a click if (a) they leave theri finger on the control for less than 500ms, or (b) they do not move their finger more than 10 pixels

* Correct patch as per original v1.0.2 code

* Prevent simulation of two clicks when interaction hasn't moved

* Updated for jQuery v3

Changed .bind and .unbind to .on and .off (works with jQuery v1.7 also)

* v1.0.5 - Update to support Lenova touch screen

Firefox on Lenova touch screen (and similar devices) was still failing the $.support.touch test.

* Update Header Comments

Updated comments and header

* Remove minified version

Minified version was the original and never updated - so has been removed from this fork

* Readme updated - removal of minified version

* Update re Issue furf#13

Change to ensure that startedMove and startPos are always reset on a touchstart, and touchMoved is reset after a touchEnd.

* Updated version number

* fix errors while using draggable during mobile scrolling

* Change version

* v1.0.8 - MS Surface Devices

Added check for MS Surface device support

Co-authored-by: Rich M <[email protected]>
Co-authored-by: Per Rovegård <[email protected]>
Co-authored-by: Sébastien Gaya <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants