【发布时间】:2012-10-10 05:36:25
【问题描述】:
我对 Phonegap 还是很陌生。我有一个问题,在干净的 Phonegap 项目中使用的默认 css 不允许输入到文本字段中。我把它缩小到一行 CSS:
* {
-webkit-touch-callout: none; /* prevent callout to copy image, etc when tap to hold */
-webkit-text-size-adjust: none; /* prevent webkit from resizing text to fit */
-webkit-tap-highlight-color: rgba(0,0,0,0); /* make transparent link selection, adjust last value opacity 0 to 1.0 */
-webkit-user-select: none; /* prevent copy paste, to allow, change 'none' to 'text' */
}
问题线是:
-webkit-user-select: none;
这可以在 www/index.css 中找到。
似乎完全禁用输入字段并不是想要的效果。
我之前也发布过 2 次此问题,但已关闭,不知道为什么...由于不是常见问题,我的问题已关闭。好吧,我只能说,我猜 stackoverflow 的一些用户不认为 CSS 3、Phonegap、HTML 5 和 -webkit-user-select: 是常见的情况。我不同意。
但是我可以看到这个问题也在这里发布,也导致 Safari 出现问题:User select:none causes input field to be inaccessible on Safari 虽然略有不同。
我目前的解决方案是这样的:
-webkit-user-select: text; /* change 'none' to 'text' */
只是仍然好奇启用文本输入的最优雅的解决方案是什么,但仍然保留了 Phonegap 试图实现的一些副本和过去的功能。谢谢!
【问题讨论】:
-
请记住,有些设备使用非 Webkit 浏览器。