更新 `enterKeyHint` 会重置 Chrome Android 上的输入值
我正在更新 enterKeyHint
动态地在自动完成库中。当存在活动项目时,Enter
键应使用“go”(暗示按 Enter
导航到该项目的链接),而当不存在时(无查询,没有结果),Enter
键应使用“搜索”。
此 DOM 更新在大多数移动浏览器上都可以正常工作,Chrome Android 除外。更新发生时,输入值将被清除。
我已经单独重现了该问题。更新从 5 个字符开始。
以下是 Galaxy S9 上的快速预览:
使用 Firefox Android,Enter
键的标签会按预期更新,并且输入值不会更改。
对于 Chrome Android,Enter
键会更新,但输入值会重置(导致 Enter
键发生新的更新等)
<一个href="https://i.sstatic.net/ujFtR.gif" rel="nofollow noreferrer">
我怀疑移动浏览器实现该规范的方式不一致,因为在 Safari iOS、Chrome iOS 和 Firefox Android 上一切都按预期工作。但是,我在网上找不到任何内容,以前似乎没有报道过这种行为(我认为更新此属性不太常见)。
有人遇到过这个问题,或者理解它吗?提前致谢!
I'm updating the value of enterKeyHint
dynamically in an autocomplete library. When there's a active item, the Enter
key should use "go" (to hint that hitting Enter
navigates to the item's link) and when there isn't (no query, no results), the Enter
key should use "search".
This DOM updates works fine on most mobile browsers, except on Chrome Android. When the update happens, the input value is cleared.
I've reproduced the issue in isolation. The update kicks in at 5 characters.
Here are quick previews on a Galaxy S9:
With Firefox Android, the Enter
key's label updates as expected and the input value doesn't change.
With Chrome Android, the Enter
key updates but the input value is reset (causing new updates to the Enter
key, etc.)
I'm suspecting an inconsistency between how mobile browsers implement the spec, since everything works as expected on Safari iOS, Chrome iOS and Firefox Android. However, I couldn't find anything online, it doesn't seem like this behavior has been reported before (I assume updating this propery isn't too commonplace).
Has anyone ever faced this issue, or understands it? Thanks in advance!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论