Reputation: 21
I am working on an iOS app with an UIWebview showing all the major content. All textfield or text area are able to bring up the virtual keyboard and input new text. However, if I want to tap on a previously entered word so I can edit that word, the cursor won't move to that location. Also, tapping and holding won't bring up the "magnifying glass" for selection / copy/paste.
I have been googling for two days already, all my textfields have the
-webkit-user-select:text
CSS setting already, and I have tried other CSS like
-webkit-writing-mode, cursor:auto, -webkit-appearance: textfield;
etc, but still couldn't work. Does anyone have similar issue and able to shed some lights on it?
Any help is appreciated!
Upvotes: 1
Views: 1129
Reputation: 21
Finally found out that it's a custom piece of code (listed below) that was added in our app to intentionally disable touch event when the input field is on focus, so that scrolling is disabled when keyboard is up, and so user is not able to scroll outside of the fixed position element in UIWebView.
$('select,input,textarea').on('focus',function(){
document.ontouchstart = function(e){ e.preventDefault(); }; //disable touch
});
$('select,input,textarea').on('blur',function(){
document.ontouchstart = function(){ return true; }; //enable touch
});
Upvotes: 1