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

JS error with draggable on windows 10 #12

Open
ankoin opened this issue Dec 15, 2019 · 4 comments
Open

JS error with draggable on windows 10 #12

ankoin opened this issue Dec 15, 2019 · 4 comments

Comments

@ankoin
Copy link

ankoin commented Dec 15, 2019

Hello !
Its a very good extension for UI !

Report a bug :
PC : Acer Aspire Z3-610
Windows 10
Bug on Chrome (Version 78.0.3904.108) and Firefox (71.0 (64 bits))
With Internet Explorer -> no problem
Jquery : jquery-1.11.0
Jquery UI : jquery-ui-1.12.1
Jquery-ui-touch-punch : jquery-ui-touch-punch-master-1.0.5
Function UI : draggable (with tactile)

If I drag element with touchscreen, we have a JS error :
TypeError: this._startPos is undefined jquery.ui.touch-punch.js:179:12

I have tested a modification with success (but i don't know if is the best solution) :

Replace :

if ((Math.abs(endPos.x - this._startPos.x) < 10) && (Math.abs(endPos.y - this._startPos.y) < 10)) {

  // 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');
  }
}

by :

if (typeof this._startPos !== "undefined") {
	if ((Math.abs(endPos.x - this._startPos.x) < 10) && (Math.abs(endPos.y - this._startPos.y) < 10)) {

		// 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');
		}
	}
}

Thank you !

@RWAP
Copy link
Owner

RWAP commented Dec 16, 2019

That is peculiar - it looks as though the touchstart was not fired. Not having a touch screen device (of any description!) can you put a break on line 109 and step through the code to see if Windows 10 is simply not firing the touchStart function (before the touchEnd), or whether something else is preventing it from reaching line 117 ?

Otherwise, your change would be fine - this is to only try and ensure that you can click on draggable elements, even if you wiggle your finger slightly

@ankoin
Copy link
Author

ankoin commented Dec 16, 2019

Hello,
Thank you.
The problem occurs only when touching the screen and only when the draggable is released. (just before this error, the draggable works well.

@RWAP
Copy link
Owner

RWAP commented Feb 24, 2020

Please try the latest version of the code now.

@RWAP
Copy link
Owner

RWAP commented Mar 14, 2021

Did you ever manage to resolve this issue?

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