Tabbing through input fields in mobile Safari makes browser jump

纵饮孤独 提交于 2019-12-07 04:00:59

问题


Is there a way to focus on the field, but without this jarring animation? The behavior is especially bad when the keyboard is visible.

Demo

http://plnkr.co/edit/9OydOFO0KUeKuaH8u70A?p=info

<!DOCTYPE html>
<html>
  <head>
    <link rel="stylesheet" href="style.css">
    <script src="script.js"></script>
  </head>
  <body>
    <form>
      <input>
      <input>
      <input>
      <input>
      <input>

       ...

      <input>
    </form>
  </body>
</html>


回答1:


After some more research, this appears to be related to a focus jumping bugs in iOS. (https://remysharp.com/2012/05/24/issues-with-position-fixed-scrolling-on-ios#focus-jumping)

One neat trick that fixed it some instances was to set float: left; clear: left; on the input field (Jumping input fields in Safari)

But that fix doesn't work if it needs to interact with a position: fixed element. The jumping bug persists.



来源:https://stackoverflow.com/questions/31126330/tabbing-through-input-fields-in-mobile-safari-makes-browser-jump

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!