fix: skip prompt hint navigation while IME is composing#6809
Open
greymoth-jp wants to merge 1 commit into
Open
fix: skip prompt hint navigation while IME is composing#6809greymoth-jp wants to merge 1 commit into
greymoth-jp wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
💻 变更类型 | Change Type
🔀 变更说明 | Description of Change
PromptHintsregisters a globalkeydownlistener that picks the highlighted hint on Enter and moves the selection with Arrow Up/Down (callingpreventDefault). TheuseSubmitHandlerhook 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 bypreventDefault.This adds the same composition check that
useSubmitHandleruses, 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.eslintreports no new problems and the existing test suite passes.