fix: prevent prematurely triggered IME comment creation
Description
When using IME for multi-language input (e.g., typing Chinese followed by English), pressing Enter during composition incorrectly submitted the comment. This happened because the Enter key event did not properly check for native composition state.
Type of Change
- [x] Bug fix (non-breaking change which fixes an issue)
- [ ] Feature (non-breaking change which adds functionality)
- [ ] Improvement (change that would cause existing functionality to not work as expected)
- [ ] Code refactoring
- [ ] Performance improvements
- [ ] Documentation update
Screenshots and Media (if applicable)
Pressing Enter during IME composition prematurely submitted the comment:
Expected Behavior (After Fix):
Test Scenarios
- Verified that comments using Chinese/Japanese IME are not prematurely submitted
- Confirmed that normal English input workflow remains unaffected
References
https://github.com/makeplane/plane/pull/7084 https://github.com/makeplane/plane/issues/7022 https://github.com/makeplane/plane/issues/7496 https://github.com/makeplane/plane/issues/5485
[!NOTE] Fixes premature comment submission when using IME by making Enter-to-submit respect composition state.
- Adds
!e.nativeEvent.isComposingcheck to Enter key handlers incomment-create.tsxandcomments/card/edit-form.tsx- Ensures comments aren't submitted during active text composition while preserving normal Enter behavior
Written by Cursor Bugbot for commit a5ac3821d8599c68f81d62909e932e7668700ca5. This will update automatically on new commits. Configure here.
Summary by CodeRabbit
- Bug Fixes
- Fixed an issue where pressing Enter during text input composition (IME) could prematurely submit comments. Submission now waits for composition to complete, improving typing and submission behavior in comment creation and edit inputs for languages using input method editors.
โ๏ธ Tip: You can customize this high-level summary in your review settings.
[!NOTE]
Other AI code review bot(s) detected
CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.
๐ Walkthrough
Walkthrough
Adds IME composition checks to Enter-key handlers in comment input components to prevent form submission while an input method editor (IME) is composing.
Changes
| Cohort / File(s) | Summary |
|---|---|
Comment creation input apps/web/core/components/comments/comment-create.tsx |
Require !e.nativeEvent.isComposing in the Enter key onKeyDown condition to avoid submit during IME composition. |
Comment edit form input apps/web/core/components/comments/card/edit-form.tsx |
Same change: add !e.nativeEvent.isComposing to Enter key onKeyDown check to prevent IME-triggered submissions. |
Estimated code review effort
๐ฏ 2 (Simple) | โฑ๏ธ ~10 minutes
Pre-merge checks and finishing touches
โ Passed checks (3 passed)
| Check name | Status | Explanation |
|---|---|---|
| Title check | โ Passed | The title clearly and concisely summarizes the main change: preventing premature comment creation when using IME input composition. |
| Docstring Coverage | โ Passed | No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. |
| Description check | โ Passed | The pull request description comprehensively covers all required template sections with clear details about the IME composition bug, type of change classification, before/after screenshots, specific test scenarios, and related issue references. |
โจ Finishing touches
- [ ] ๐ Generate docstrings
๐งช Generate unit tests (beta)
- [ ] Create PR with unit tests
- [ ] Post copyable unit tests in a comment
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 @coderabbitai help to get the list of available commands and usage tips.
Hi @vamsikrishnamathala @prateekshourya29 , could you please help review this PR?