jquery-ui-touch-punch icon indicating copy to clipboard operation
jquery-ui-touch-punch copied to clipboard

Text Boxes are not editable on iPad

Open csergent45 opened this issue 11 years ago • 10 comments

When referencing jquery-ui-touch-punch, my textboxes can not be edited when I touch them on iPad4 or iPhone5.

I am currently using jquery-1.9.1.js and jquery-ui-1.10.3.js.

csergent45 avatar Mar 05 '14 18:03 csergent45

try to update some code lines in jquery-ui-touch-punch.js

Original code: mouseProto._touchStart = function (event) {

var self = this;

// Ignore the event if another widget is already being handled
if (touchHandled || !self._mouseCapture(event.originalEvent.changedTouches[0])) {
  return;
}

Updated code: mouseProto._touchStart = function (event) {

var self = this;

// Ignore the event if another widget is already being handled
if (touchHandled || !self._mouseCapture(event.originalEvent.changedTouches[0]) || event.originalEvent.target.localName==='textarea' || event.originalEvent.target.localName==='input') {
  return;
}

it worked for me

ngocnt1 avatar Mar 27 '14 07:03 ngocnt1

I tried it, but I can no longer drag the draggable interface that the textboxes display on.

On Thu, Mar 27, 2014 at 2:19 AM, ngocnt1 [email protected] wrote:

try to update some code lines in jquery-ui-touch-punch.js

Original code: mouseProto._touchStart = function (event) {

var self = this;

// Ignore the event if another widget is already being handled if (touchHandled || !self._mouseCapture(event.originalEvent.changedTouches[0])) { return; }

Updated code: mouseProto._touchStart = function (event) {

var self = this;

// Ignore the event if another widget is already being handled if (touchHandled || !self._mouseCapture(event.originalEvent.changedTouches[0]) || event.originalEvent.target.localName==='textarea' || || event.originalEvent.target.localName==='input') { return; }

it worked for me

Reply to this email directly or view it on GitHubhttps://github.com/furf/jquery-ui-touch-punch/issues/142#issuecomment-38775027 .

csergent45 avatar Mar 28 '14 16:03 csergent45

Below is full code , it is tested on iPad safari and Nexus 7 chrome

/**

  • Handle the jQuery UI widget's touchstart events

  • @param {Object} event The widget element's touchstart event */ mouseProto._touchStart = function (event) {

    var self = this; if (event.originalEvent.target.localName == 'textarea' || event.originalEvent.target.localName == 'input') { return true; } // Ignore the event if another widget is already being handled if (touchHandled || !self._mouseCapture(event.originalEvent.changedTouches[0])) { return; }

    // Set the flag to prevent other widgets from inheriting the touch event touchHandled = true;

    // Track movement to determine if interaction was a click self._touchMoved = false;

    // Simulate the mouseover event simulateMouseEvent(event, 'mouseover');

    // Simulate the mousemove event simulateMouseEvent(event, 'mousemove');

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

ngocnt1 avatar Mar 31 '14 07:03 ngocnt1

for Surface RT IE11: you should add the below code line

$("#draggable").css('-ms-touch-action', 'none');

ngocnt1 avatar Apr 02 '14 09:04 ngocnt1

Thank you, ngocnt1. That solved the problem!!

tony873004 avatar Apr 03 '14 00:04 tony873004

This worked for me too, just added:

if (event.originalEvent.target.localName == 'textarea' || event.originalEvent.target.localName == 'input') {
      return true;
}

I think this should be placed inside the original code. Can you push a merge request? It could be useful for new users.

Thanks anyway!

michelem09 avatar Jun 17 '14 06:06 michelem09

ok, i will make a request for merging

Sent from my Windows Phone


From: Michele Marcuccimailto:[email protected] Sent: ‎17/‎06/‎2014 13:59 To: furf/jquery-ui-touch-punchmailto:[email protected] Cc: ngocnt1mailto:[email protected] Subject: Re: [jquery-ui-touch-punch] Text Boxes are not editable on iPad (#142)

This worked for me too, just added:

if (event.originalEvent.target.localName == 'textarea' || event.originalEvent.target.localName == 'input') {
      return true;
}

I think this should be placed inside the original code. Can you push a merge request? It could be useful for new users.

Thanks anyway!


Reply to this email directly or view it on GitHub: https://github.com/furf/jquery-ui-touch-punch/issues/142#issuecomment-46273409

ngocnt1 avatar Jun 17 '14 12:06 ngocnt1

Change in _jquery.ui.touch-punch.js_ worked for me. JS: jquery.ui.touch-punch.js Method to modify:

    //line: 31    
    function simulateMouseEvent(event, simulatedType) {
     //...
    }
    //changes to add ++
    if ($(event.target).is("input") || $(event.target).is("textarea")) {
        return;
    } else {
        event.preventDefault();
    }

deepakshrma avatar Dec 04 '15 11:12 deepakshrma

Thanks @deepakshrma , in addition, you might also want to add

|| $(event.target).is("button")

to the end of that list. Otherwise buttons inside draggable divs can't be tapped.

ubill avatar Dec 21 '15 11:12 ubill

@ubill hahahhah! :-D it was not in my case. Thanks anyways :-) :+1:

deepakshrma avatar Dec 21 '15 11:12 deepakshrma