[英]Onclick event for input field doesn't work while accessibility screen reader is running
Onclick event for input field doesn't work while accessibility screen reader is running. 可访问性屏幕阅读器运行时,输入字段的Onclick事件不起作用。
I use this HTML example for many years. 我使用这个HTML示例很多年了。 But since Android 8, it doesn't work.
但是从Android 8开始,它就不起作用了。 Until Android 8, the onclick event was triggered by a double-tap action while the screen reader is running.
在Android 8之前的版本中,屏幕阅读器运行时,双击动作触发了onclick事件。
<input type="text" name="pwd1" id="pwd1" onclick="alert('test');" />
I want it to work as before Android 8. I want the onclick event for a div to act as a double tap. 我希望它能像Android 8之前那样工作。我希望div的onclick事件可以双击。 But since Android 8, it doesn't work.
但是从Android 8开始,它就不起作用了。
Using onclick on an input text field is anyway a bad practice. 无论如何,在输入文本字段上使用onclick都是不好的做法。 You should probably use onfocus instead.
您可能应该改用onfocus。
Reasons why you shouldn't use onclick include: 您不应该使用onclick的原因包括:
You probably want to do something when the field gets the focus, not when the field is clicked; 您可能想在该字段获得焦点时执行某些操作,而不是单击该字段时; in that case, use onfocus.
在这种情况下,请使用onfocus。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.