简体   繁体   English

输入文本字段不会在鼠标单击时移动光标?

[英]Input Text fields don't move cursor on mouse click?

I have an issue with all of my Input Text fields, maybe someone has an idea:我的所有Input Text字段都有问题,也许有人有想法:

I'm using GWT , and just discovered that the text in of my Input Fields cannot be selected using Mouse.我正在使用GWT ,刚刚发现无法使用鼠标选择我的输入字段中的文本。 Also clicking inside the text does not move the cursor.同样在文本内部单击不会移动光标。

But giving them Focus using the cursor works.但是使用光标给他们焦点是有效的。 Selecting all with CTRL+A as well as moving the cursor with Arrow Keys works as expected.使用 CTRL+A 全选以及使用箭头键移动光标按预期工作。

I inspected the TextBox specific onBrowserEvents() method and can see, that click events are received well.我检查了TextBox特定的onBrowserEvents()方法,可以看到,点击事件被很好地接收。 Just somehow they don't modify the text input control in the browser.只是不知何故,他们不会修改浏览器中的文本输入控件。

I tested different machines and different browsers, which all behave the same.我测试了不同的机器和不同的浏览器,它们的行为都一样。 So it must be something in my Application.所以它一定是我的应用程序中的东西。

Maybe somebody has an idea what I could have done wrong?也许有人知道我可能做错了什么? I can't even imagine anything that could produce this behaviour on all of my input fields.我什至无法想象任何可以在我的所有输入字段上产生这种行为的东西。

It just turned out to be a CSS issue:结果证明这是一个CSS问题:

I had -moz-user-select: -moz-none;我有-moz-user-select: -moz-none; to prevent doubleclick issues for some of my components.防止我的某些组件出现双击问题。 I now excluded the input element from it and everything works fine again.我现在从中排除了输入元素,一切又正常了。

I use this to solve the problem with selecting text and moving the cursor on the text in the inputs:我用它来解决选择文本并将光标移动到输入文本上的问题:

*, ::before, ::after
    -webkit-user-select: text

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

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