Skip to content

fix: skip prompt hint navigation while IME is composing#6809

Open
greymoth-jp wants to merge 1 commit into
ChatGPTNextWeb:mainfrom
greymoth-jp:fix/prompt-hint-ime-composition
Open

fix: skip prompt hint navigation while IME is composing#6809
greymoth-jp wants to merge 1 commit into
ChatGPTNextWeb:mainfrom
greymoth-jp:fix/prompt-hint-ime-composition

Conversation

@greymoth-jp

Copy link
Copy Markdown

💻 变更类型 | Change Type

  • fix

🔀 变更说明 | Description of Change

PromptHints registers a global keydown listener that picks the highlighted hint on Enter and moves the selection with Arrow Up/Down (calling preventDefault). The useSubmitHandler hook just above it in this file already skips Enter while an IME is composing (e.keyCode == 229 / e.nativeEvent.isComposing, with the comment "Fix Chinese input method 'Enter'"), but this listener has no such guard.

So while the hint list is open (for example after typing /, or the full-width command prefix) and a CJK user is mid-composition, the Enter that should confirm the IME composition selects a hint instead, and the Arrow keys used to move through IME candidates get swallowed by preventDefault.

This adds the same composition check that useSubmitHandler uses, so the listener ignores keydown while the IME is composing. Behavior outside composition is unchanged.

📝 补充信息 | Additional Information

The guard mirrors the existing one in useSubmitHandler (same file). I checked that without it an IME-confirming Enter selects a hint and the Arrow keys are preventDefaulted mid-composition, while a normal Enter still selects the highlighted hint. eslint reports no new problems and the existing test suite passes.

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

Labels

None yet

1 participant