fix(sender): avoid submit after composition end in safari#1732
fix(sender): avoid submit after composition end in safari#1732IsDyh01 wants to merge 3 commits intoant-design:mainfrom
Conversation
Summary of ChangesHello @IsDyh01, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request resolves a bug where pressing Enter immediately after an IME composition finishes could lead to an unintended form submission, particularly in Safari. The fix introduces a short delay after composition ends to differentiate between a composition completion and an intentional Enter key press for submission, thereby improving the reliability of text input in the Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
📝 WalkthroughWalkthrough在 TextArea 中添加了对输入法组合(composition)结束后的短暂冷却:记录最近一次 compositionend 的时间戳,并在 Enter 键处理时若在 100ms 内刚结束组合则阻止提交。新增单元测试覆盖该场景。 Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 分钟 诗歌
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Code Review
This pull request introduces a fix to prevent unintended form submission after an IME composition ends, a known issue in Safari. The approach of using a timestamp to create a small debounce period after compositionend is a sound solution. My feedback focuses on improving code maintainability by replacing a magic number with a named constant, which will make the code clearer and easier to manage.
Bundle ReportChanges will increase total bundle size by 68 bytes (0.0%) ⬆️. This is within the configured threshold ✅ Detailed changes
Affected Assets, Files, and Routes:view changes for bundle: antdx-array-pushAssets Changed:
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1732 +/- ##
==========================================
+ Coverage 97.34% 97.41% +0.06%
==========================================
Files 144 144
Lines 4598 4606 +8
Branches 1295 1307 +12
==========================================
+ Hits 4476 4487 +11
+ Misses 120 117 -3
Partials 2 2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
我研究下 应该有特性判断 |
是不是可以通过keyocde=229来判断,不管是safari还是google那些浏览器,只要是组合状态下keycode都为229 |

中文版模板 / Chinese template
🤔 This is a ...
🔗 Related Issues
#1700
💡 Background and Solution
📝 Change Log
Summary by CodeRabbit