Skip to content

fix: prevent IME composition Enter from triggering submit actions#8893

Open
tony140407 wants to merge 1 commit intomakeplane:previewfrom
tony140407:fix/ime-enter-key
Open

fix: prevent IME composition Enter from triggering submit actions#8893
tony140407 wants to merge 1 commit intomakeplane:previewfrom
tony140407:fix/ime-enter-key

Conversation

@tony140407
Copy link
Copy Markdown

@tony140407 tony140407 commented Apr 14, 2026

Description

Fix IME (Input Method Editor) composition conflict with Enter key
in comment inputs and other text fields.

When using CJK input methods (Chinese Zhuyin/Bopomofo, Japanese IME,
Korean IME), pressing Enter to confirm character selection
unintentionally triggers form submission. On macOS, pressing Enter
during IME composition still fires a keydown event, and existing
handlers did not check for active composition state.

Changes (5 files)

Comment inputs (improved upon PR #8425 by @LinEvil):

  • comment-create.tsx — added isComposing + keyCode === 229 guard
  • edit-form.tsx — same

Other CJK text input areas (new):

  • gpt-assistant-popover.tsx — AI assistant prompt input
  • link-edit-view.tsx — link text editing in editor
  • link-selector.tsx — link selector in editor

Note on EnterKeyExtension (ProseMirror plugin)

During investigation, CodeRabbit flagged in PR #8425 that the
Tiptap EnterKeyExtension could be a second pathway for
Enter-triggered submission. After deeper analysis, I found that
ProseMirror's core already guards against this — its
editHandlers.keydown calls inOrNearComposition(view, event)
which checks view.composing and includes a 500ms grace period
for Safari's compositionend timing. This means
addKeyboardShortcuts in Tiptap extensions are never invoked
during IME composition in the first place, so no fix is needed
at that layer.

Guard pattern

// React layer (SyntheticEvent)
if (e.nativeEvent.isComposing || e.keyCode === 229) return;

keyCode === 229 is a fallback for browsers where
compositionend fires before keydown, causing isComposing
to already be false on the final confirmation Enter.

Relationship to existing PRs

Type of Change

  • Bug fix (non-breaking change which fixes an issue)

Test Scenarios

  • CJK IME (Chinese Zhuyin, Japanese) — Enter during
    composition confirms character, does NOT submit
  • English input — Enter submits normally
  • Shift+Enter — Creates new line, unaffected
  • macOS + Chrome

References

Closes #5485
Related: #7022, #7084, #8425

Summary by CodeRabbit

Bug Fixes

  • Fixed Enter key behavior during IME (Input Method Editor) composition in comment creation/editing, AI assistant popover, and link editor components to prevent accidental form submissions when typing in CJK languages.

CJK input methods (Chinese Zhuyin, Japanese IME, Korean) use Enter to
confirm character selection during composition. This conflicts with
Enter-to-submit handlers across the app, causing premature submissions.

Add isComposing + keyCode 229 checks to 5 locations:
- Comment create and edit forms
- GPT assistant prompt input
- Link edit view and link selector in editor

Addresses: makeplane#5485, makeplane#7022
Related: makeplane#7084, makeplane#8425

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings April 14, 2026 08:32
@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Apr 14, 2026

CLA assistant check
All committers have signed the CLA.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 14, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 549d4c4b-b5a4-400c-ad45-91699bb4957d

📥 Commits

Reviewing files that changed from the base of the PR and between 13db2f8 and 900ff57.

📒 Files selected for processing (5)
  • apps/web/core/components/comments/card/edit-form.tsx
  • apps/web/core/components/comments/comment-create.tsx
  • apps/web/core/components/core/modals/gpt-assistant-popover.tsx
  • packages/editor/src/core/components/links/link-edit-view.tsx
  • packages/editor/src/core/components/menus/bubble-menu/link-selector.tsx

📝 Walkthrough

Walkthrough

Adds IME composition detection guards (isComposing and keyCode === 229) to Enter key handlers across five components in the web and editor packages, preventing premature form submission during Input Method Editor (IME) text composition.

Changes

Cohort / File(s) Summary
Web App Comment Components
apps/web/core/components/comments/card/edit-form.tsx, apps/web/core/components/comments/comment-create.tsx
Added early return guards in Enter onKeyDown handlers to skip submit logic when IME composition is active (isComposing or keyCode === 229).
Web App Core Modals
apps/web/core/components/core/modals/gpt-assistant-popover.tsx
Added guard in global keydown handler to prevent handleSubmit execution during IME composition.
Editor Package Link Components
packages/editor/src/core/components/links/link-edit-view.tsx, packages/editor/src/core/components/menus/bubble-menu/link-selector.tsx
Added guards in Enter onKeyDown handlers to block submission logic during active IME composition.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related issues

Poem

🐰 A rabbit hops through compositions,
IME states now grant permission,
Enter keys no longer leap,
While Japanese characters sleep,
Peace at last—the form won't creep! ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: preventing IME composition Enter key from triggering submit actions across multiple components.
Description check ✅ Passed The description comprehensively covers all template sections including detailed explanation of changes, proper bug fix categorization, thorough test scenarios, and relevant issue references.
Linked Issues check ✅ Passed The PR directly addresses issue #5485 by adding guards in the onKeyDown handlers to prevent IME composition Enter from triggering form submission, matching the reported problem and expected fix.
Out of Scope Changes check ✅ Passed All five file changes are narrowly scoped to adding IME composition guards in Enter key handlers across comment and text input components, with no unrelated modifications.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Prevents Enter key presses used to confirm IME (CJK) composition from unintentionally triggering submit actions across comment inputs and other Enter-to-submit text fields in the web app and editor UI.

Changes:

  • Added an IME-composition guard (isComposing + keyCode === 229 fallback) to Enter key handlers in comment create/edit flows.
  • Added the same guard to AI assistant prompt submission (global keydown handling).
  • Added the same guard to editor link editing/selection inputs to avoid premature link submit while composing.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
packages/editor/src/core/components/menus/bubble-menu/link-selector.tsx Ignore IME composition Enter before running Enter-to-submit link handler.
packages/editor/src/core/components/links/link-edit-view.tsx Ignore IME composition Enter before applying/closing link edits.
apps/web/core/components/core/modals/gpt-assistant-popover.tsx Ignore IME composition Enter in the global Enter-to-submit listener while popover is open.
apps/web/core/components/comments/comment-create.tsx Ignore IME composition Enter in the wrapper keydown submit handler.
apps/web/core/components/comments/card/edit-form.tsx Ignore IME composition Enter in the wrapper keydown submit handler.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[bug]: Unable to leave a full comment in Japanese due to return key for IME confirmation prematurely triggers submission

3 participants