点击< label>在移动Safari中 [英] Tapping on <label> in Mobile Safari
问题描述
点击< label>
不会在Mobile Safari中自动对焦关联但如果定义了一个空函数作为clickhandler,那么
就像这样
Tapping on <label>
does not auto-focus linked in Mobile Safari but If an empty function as clickhandler is defined
like this
document.getElementById("test_label").onclick = function () {};
解决问题。
这是完整的源代码。
<body>
<input type="checkbox" id="test" name="test">
<label for="test" id="test_label">This is the label</label>
<script>
document.getElementById("test_label").onclick = function () {};
</script>
</body>
你知道它为什么有用吗?
Do you know why it works?
推荐答案
您好像在iOS Safari中发现了一个错误。恭喜!查找和报告错误会令人上瘾。
It looks like you found a bug in iOS Safari. Congratulations! Finding and reporting bugs is addictive.
您可以通过 https://bugreport.apple.com/ 。 Apple可能不会立即跟进,但在将来的某个时候,他们应该通知您这是一个现有错误的副本,他们不认为这是一个错误,或者(如果你很幸运)你应该测试它再次出现在新版本的iOS中。
You can report this and other bugs to Apple at https://bugreport.apple.com/. Apple might not follow up immediately, but at some point in the future they should notify you that it was a duplicate of an existing bug, that they don’t consider it a bug, or (if you’re lucky) that you should test it again in a new version of iOS.
同时,请坚持这个变通方法 - 你需要它。
In the mean time, hold onto this workaround — you’ll need it.
这篇关于点击< label>在移动Safari中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!