iOS 7 Safari: OS locks up for 4 seconds when click

2019-01-21 09:19发布

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!

13条回答
老娘就宠你
2楼-- · 2019-01-21 09:58

I have encountered this problem as well since I noticed many people are still having a problem with this I thought I'd put my solution.

Basically my solution is server side hiding of elements. My page is ASP.NET so I wrapped my divs with the inputs with Panels and set these panels as Visible false. This way if I click on an input the safari can't see all the other controls since they are hidden server side.

Of course if you want to make this work a little like clientside jquery you'll need automatic postback and an updatepanel somewhere. This solution requires an effort but still its better than actually trying to fix a safari bug.

Hope this helps.

查看更多
登录 后发表回答