javascript <input> 有焦点,但无法在 WebKit 中输入
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/11679358/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
<input> has focus, but can't type in WebKit
提问by BenM
I have run into a slight problem, and have been tyring to debug it for the past two hours. After deciding that a fresh brain might be able to assist, I decided to post here.
我遇到了一个小问题,过去两个小时一直在调试它。在决定一个新鲜的大脑可能会有所帮助后,我决定在这里发帖。
I know that I should post some code here for legacy purposes, but the question involves significant amounts of code, so it's easier to provide a link.
我知道我应该在这里发布一些代码用于遗留目的,但问题涉及大量代码,因此提供链接更容易。
Please check out the following page: http://ben-major.co.uk/labs/phonee/#overlays. If you tap on Prompt
(in Chrome or Mobile Safari), you are presented with a prompt box. Here's the snag:
请查看以下页面:http: //ben-major.co.uk/labs/phonee/#overlays。如果您点击Prompt
(在 Chrome 或 Mobile Safari 中),您会看到一个提示框。这是障碍:
The field has focus (see the white background, rather than the #eee
color of the unfocused field), but when trying to type anything into the field, nothing happens, despite the field having focus. I have tried on my MBP (Chrome), iMac (Chrome), iPad + iPhone, and all have the same problem.
该字段具有焦点(请参阅白色背景,而不是#eee
未聚焦字段的颜色),但是当尝试在该字段中键入任何内容时,尽管该字段具有焦点,但没有任何反应。我在 MBP (Chrome)、iMac (Chrome)、iPad + iPhone 上试过,都遇到同样的问题。
Has anyone run into a similar problem, as I really cannot figure out why this doesn't work. There are no event preventions on keyup or similar events...
有没有人遇到过类似的问题,因为我真的不明白为什么这不起作用。没有对 keyup 或类似事件的事件预防...
回答by Joe Johnson
-webkit-user-select: none;
Remove that style, and it works. You can alter it in the reset.css file you're using. This works -webkit-user-select: auto;
as well.
删除该样式,它的工作原理。您可以在您正在使用的 reset.css 文件中更改它。这-webkit-user-select: auto;
也有效。
回答by Undefined
On line 46 of reset.css you have -webkit-user-select: none;
this doesnt allow users to select the textbox on webkit browsers!
在 reset.css 的第 46 行,您-webkit-user-select: none;
不允许用户在 webkit 浏览器上选择文本框!