UPDATE: The issue seems to stem from having many select elements on a page. How random is that?
So here's the issue. On iOS 7 Safari, when tapping the a text input on my site, the keyboard opens then freezes the OS for about 2-5 seconds then finally scrolls to the input. After this happens once, it never happens again until you refresh the page. I've looked all over the place, and yes, iOS 7 Safari is super buggy, but lets try and see if we can figure this out.
Note: This does not happen in any other mobile browser or any previous iOS Safari. It happens both on the ios 7 iphone and ios 7 ipad.
I will list everything my friend and I have tried so far:
- Removed the ability to add event handlers in jQuery. (Note: all our event handlers are assigned through jQuery except for unload and onpageshow).
- Removed the jQuery autocomplete script from the inputs.
- Removed all JavaScript from the inputs.
- Removed all third-party libraries being added on the page by rejecting the domains on the Mac.
- Switched back to previous jQuery versions. The last one we could actually use before nothing worked was 1.7.0.
- Switched back to previous jQuery UI versions.
- Changed input event handling to delegate and live, instead of on('click')
- Removed all CSS classes.
- Removed all CSS from the page. Note: The response time for the OS this went down to 1-2 seconds but still happened.
Does anyone have any ideas?
Thanks a bunch!
have you tried to turn off "Password & Autofill" > "Credit Cards" into Safari settings ? After this operation it works fine. This isn't a final solution but maybe the problem's reason on iOS.
For me, this issue was being caused by user inputs being hidden on the page with
display:none
.The workaround I used: instead of hiding inputs with
display:none
, I used jQuery'sdetach()
method on document ready to 'hide' all the user inputs that were not being used. Thenappend()
the inputs when they were needed.That way no inputs had
display:none
on when the page was first loaded and so no delay occurred on the initial user interaction.Struggled with this issue as well within an ios fullscreen which was inserting /removing pages containing a single input element. Was experiencing delays up to 30 seconds with only a single visible text input element on the page (and within the entire DOM). Other dynamically inserted pages with single or multiple text inputs in the same webapp were not experiencing the input delay. Like others have mentioned, after the initial delay, the input field would behave normally on subsequent focus events (even if the dynamic page containing the input element was removed from the DOM, then dynamically re-rendered/inserted back into the DOM).
On a hunch based on the above behaviour, tried the following on page load:
$("#problem-input").focus(); $("#problem-input").blur();
While the above executes immediately with no delay, the end result is no subsequent delays when the input gets focus via user interaction. Can't explain the reason behind this working, but it appears to work consistently for my app while other suggested fixes have failed.
Met the same problem in quite complex application having many inputs.
Attached debugger to Safari iOS7 via USB and logged UI events. I see "touchend" event coming as soon as I am clicking on textarea (or any input) and in 10-20 seconds after that I see "click" being dispatched.
Clearly it is a bug in Safary as on other devices like Android or iOS6 there is no problem with the very same application.
We had the same or a similar problem at my company. Whenever we displayed a large number of drop down lists and then a user clicked on a drop down, IOS 7 would freeze the page for a minute or two. After it unfroze, everything would work properly from that point forward.
This affected all input types. The large number of drop downs were actually hidden on first load - the user would initiate the display of the drop downs. Until the drop downs were displayed - everything would work fine. As soon as they were displayed, the next input click, even an input that had been working properly, now would cause the browser to freeze.
As others have noted, it seems that IOS 7 has a problem when parsing the visible inputs in the DOM after the user first interacts with an input. When the number and/or complexity of the elements/options/DOM are higher, the freeze is more pronounced.
Because it always froze on the initial user interaction, we decided to initiate a hidden user action as soon as we displayed the list of drop downs. We created a transparent button (it could not be hidden - it had to be "displayed") and initiated a click on it as soon as the user opened the drop down list. We thought that this would make IOS start parsing the DOM quicker, but found that it actually fixed the problem completely.
iOS 12.1.1 - December 2018
Here is a simple fix that worked in my case:
window.scrollTo(0,0)
// attached to 'blur' event for the input fieldsWhile it may not be ideal in terms of UX (especially if you have a form with many fields), it's definitely better than having 10+ second freezing time.