按住智能手机上触摸的按钮会导致选择按钮元素

holding a button touched on smartphone causes the button element to be selected

我研究了我之前使用 onmousedownontouchstart 的问题,现在我意识到使用智能手机(至少使用 android),按住手指触摸不正常移动使元素被选中。然而,使用鼠标时,按住点击效果非常好。

现在,我的问题是,我的目标是用户必须付出一些努力才能使堆栈增长,为此,按住鼠标单击一段时间就是努力。所以我现在在想,也许智能手机最好有一些其他的努力设计,比如移动手指或其他东西。

无论如何,如果我仍要继续尝试通过手指触摸来复制此鼠标逻辑,我是否必须以某种方式告诉浏览器类似 'holding touch pressed does not mean selecting an element/this element' 的内容?

非常感谢!

在 iOS 至少你可以使用 -webkit-user-select: none 来防止这种行为。我亲自在 iPhone 上进行了测试。