input icon indicating copy to clipboard operation
input copied to clipboard

在 Mac 系统上使用中文输入法时,onPressEnter 是否存在问题?

Open Dreamer-Paul opened this issue 2 years ago • 0 comments

公司项目使用了 Antd,而 Antd 依赖了 rc-input 的代码。通过查看源码后发现 onPressEnter 使用了 onkeydown 实现检查是否按下 Enter,但这种实现会导致在 Mac 系统上使用中文输入法的情况下,输入任意内容不选择任何联想项时按下 Enter 键,会触发对应逻辑,正常情况下应该不做处理?个人尝试后发现使用 onkeypress 是没有问题的。

这是我写的 最小复现 Demo,如果使用非 onkeypress 的方式捕获,则会触发此问题,Windows 貌似没有出现此问题。

rc-input 的最小复现

https://user-images.githubusercontent.com/25198337/197444497-1e93cdf7-37ed-4bdd-a8c8-1bd70fa5bf5c.mp4

Dreamer-Paul avatar Oct 24 '22 03:10 Dreamer-Paul