简体   繁体   English

iOS Safari 双击按钮问题

[英]iOS Safari Double Tap Button Issue

I'm creating a mobile app with Meteor and I'm having problems with buttons in the Safari Webview.我正在使用Meteor创建一个移动应用程序,但在 Safari Webview 中遇到按钮问题。 It seems like at totally random times and buttons, I'm forced to tap on something twice in order for the click to register.似乎在完全随机的时间和按钮上,我被迫点击某些东西两次才能点击注册。 I have research a lot about the problems and all the answers have not worked for me.我对这些问题进行了大量研究,但所有答案都对我不起作用。

Almost all the buttons/links in my app use javascript for their function.我的应用程序中几乎所有的按钮/链接都使用 javascript 来实现它们的功能。 I don't use any :hover in my CSS.我没有在我的 CSS 中使用任何:hover

I can't find any pattern or reason for when it happens.我找不到它发生的任何模式或原因。 It seems totally random.这似乎完全是随机的。 It makes my app feel unresponsive and slow because you have to tap half of the stuff twice for it to register.它让我的应用程序感觉没有响应和缓慢,因为你必须点击一半的东西两次才能注册。 I doesn't seem to happen when I'm using the app in a desktop browser.当我在桌面浏览器中使用该应用程序时,我似乎没有发生这种情况。

Has anyone ran into this problem before or know of solutions?有没有人遇到过这个问题或知道解决方案?

At the time of tapping, are your buttons in the bottom 44px of the viewport?在点击时,您的按钮是否位于视口底部 44 像素? It could be caused by Safari's hostile menu bar .这可能是由Safari 的敌对菜单栏引起的。

If so the only solution I can think of is to move those links outside of that area.如果是这样,我能想到的唯一解决方案是将这些链接移到该区域之外。 If anyone has a better solution, I'd be interested myself as well.如果有人有更好的解决方案,我也会对自己感兴趣。 (None of the solutions I've found have worked so far, including styles on the content; (到目前为止,我发现的所有解决方案都没有奏效,包括内容样式;

.parent {
  overflow-y: scroll;
  height: 100%;
  -webkit-overflow-scrolling: touch;
}

or adding some padding to the bottom positioned element;或向底部定位的元素添加一些填充;

.bottom-positioned-element {
   padding-bottom: env(safe-area-inset-bottom);
}

I ran into this problem with a link on my page so I applied this SCSS / CSS solution.我在我的页面上遇到了这个问题,所以我应用了这个 SCSS/CSS 解决方案。 Is it possible with your setup that a hover is being added elsewhere to some of the links..?您的设置是否有可能将悬停添加到某些链接的其他地方..? even though there is no style change..?即使没有风格变化..?

https://gist.github.com/PocketNinjaDesign/689e16e412a88dfd36dd08b26bebcacf https://gist.github.com/PocketNin​​jaDesign/689e16e412a88dfd36dd08b26bebcacf

a.close {
  background: #fc0;

  @media (hover: hover) {
    &:hover {
      background: #f00;
    }
  }
}

as specified in the mozzilla docs ;-) https://developer.mozilla.org/en-US/docs/Web/CSS/@media/hover如 mozzilla 文档中所述;-) https://developer.mozilla.org/en-US/docs/Web/CSS/@media/hover

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM