[PR #31758] fix: add IME-safe onPressEnter prop to base Input component #33387

Open
opened 2026-02-21 20:53:11 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/langgenius/dify/pull/31758

State: open
Merged: No


Closes #31757

Summary

  • Add onPressEnter prop to the base Input component with built-in IME composition detection, preventing CJK input method Enter-to-confirm from triggering form submissions
  • Uses isComposingRef + onCompositionStart/End + setTimeout(50ms) for Safari compatibility (same pattern as chat-input-area)
  • Migrate all 5 call sites from manual onKeyDown Enter detection to onPressEnter

Test plan

  • English input: type text, press Enter → triggers onPressEnter
  • Chinese IME: type pinyin, press Enter to confirm candidate → does NOT trigger onPressEnter
  • Chinese IME: after confirming candidate, press Enter again → triggers onPressEnter
  • Safari browser: same behavior as above
  • Sign-in password input (admin + webapp): Enter submits login
  • Invite settings name input: Enter activates account
  • Goto Anything: Enter executes slash command
  • Pagination: Enter confirms page number, Escape cancels
**Original Pull Request:** https://github.com/langgenius/dify/pull/31758 **State:** open **Merged:** No --- Closes #31757 ## Summary - Add `onPressEnter` prop to the base `Input` component with built-in IME composition detection, preventing CJK input method Enter-to-confirm from triggering form submissions - Uses `isComposingRef` + `onCompositionStart/End` + `setTimeout(50ms)` for Safari compatibility (same pattern as `chat-input-area`) - Migrate all 5 call sites from manual `onKeyDown` Enter detection to `onPressEnter` ## Test plan - [ ] English input: type text, press Enter → triggers `onPressEnter` - [ ] Chinese IME: type pinyin, press Enter to confirm candidate → does NOT trigger `onPressEnter` - [ ] Chinese IME: after confirming candidate, press Enter again → triggers `onPressEnter` - [ ] Safari browser: same behavior as above - [ ] Sign-in password input (admin + webapp): Enter submits login - [ ] Invite settings name input: Enter activates account - [ ] Goto Anything: Enter executes slash command - [ ] Pagination: Enter confirms page number, Escape cancels
yindo added the pull-request label 2026-02-21 20:53:11 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#33387