Repository navigation
fix(desktop): leave Enter and Escape to an IME composition in log and page search - #153803
Open
wonjangcloud9 wants to merge 1 commit into
Open
wonjangcloud9 wants to merge 1 commit into
wonjangcloud9 wants to merge 1 commit into
Conversation
… page search The chat log search field mapped Enter to next/previous itself before it asked findBarKeyAction, so it skipped the IME check that function already has for Enter. On macOS a Korean Enter arrives twice (keyCode 229 while the last syllable composes, then 13), so one Enter stepped two matches; a Japanese Enter that only confirms a conversion stepped one. findBarKeyAction also mapped a composing Escape to "close". A Japanese or Chinese Escape cancels the conversion, so the page find bar closed and the log search cleared the query being typed. findBarKeyAction now returns null for any key inside a composition, and the log search uses it for Enter too (Enter and Shift+Enter keep their meaning; a modified Enter no longer steps, as in the page find bar). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
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.
What does this PR do?
The desktop app's chat log search and page find bar now leave Enter and Escape alone while an input method (Korean, Japanese, Chinese) is still composing.
LogSearchField(components/chat/log-search.tsx) mapped Enter to next/previous itself and only askedfindBarKeyActionfor other keys.findBarKeyActionalready ignores a composing Enter (Desktop text fields no longer submit on IME composition Enter (salvage #94611, port cloudflare-os#291) #95245 made that the shared policy), but this field never reached that check. On macOS a Korean Enter arrives twice, as keyCode 229 while the last syllable is composing and then 13, so a single Enter stepped two matches. A Japanese Enter that only confirms a conversion stepped one.findBarKeyActionmapped every bare Escape toclose. In Japanese and Chinese, Escape cancels the conversion. So the page find bar closed mid-query, and the log search cleared the whole query (itscloseisonChange('')).Now
findBarKeyActionreturnsnullfor any key inside a composition, andLogSearchFielduses it for Enter too. Enter and Shift+Enter keep their meaning. A modified Enter (⌘/Ctrl/Alt+Enter) no longer steps matches in log search, the same as in the page find bar.Related Issue
No issue. #95245 added the shared
isImeComposingpolicy and its Enter case infindBarKeyAction, and this applies it to the call site that bypassed it and to Escape. I searched for duplicates with "log-search", "LogSearchField", "findBarKeyAction", "find bar IME" and "search composition desktop".Type of Change
Changes Made
apps/desktop/src/lib/find-in-page.ts:findBarKeyActionreturnsnullwhenisImeComposing(event), covering Escape as well as Enter. The Enter branch drops its own check, which is now redundant.apps/desktop/src/components/chat/log-search.tsx:const action = findBarKeyAction(event, { inInput: true }).apps/desktop/src/components/chat/log-search.test.tsx(new): Enter, Shift+Enter and Escape still step and clear. A composing Enter (isComposing, keyCode 229), the post-composition Enter with keyCode 229, and a composing Escape do nothing.apps/desktop/src/components/find-bar.test.tsx:findBarKeyActionreturnsnullfor a composing Escape.How to Test
pnpm exec vitest run --project ui src/components/chat/log-search.test.tsx src/components/find-bar.test.tsxinapps/desktop. Onmainthe two new cases fail:search.nextis called twice by the composing Enters, andexpected 'close' to be null. Both pass here.pnpm exec vitest run --project ui src/components/chat/log-search.test.tsx src/components/find-bar.test.tsx src/lib: 234 files, 2304 tests passed.tsc -p . --noEmit, ESLint on the changed files (0 problems;find-bar.test.tsxhas the same 9 warnings as onmain), andscripts/checkare clean.I tested with synthetic keyboard events (testing-library) and did not drive the packaged Electron app with a real IME.
Checklist
Code
fix(scope):,feat(scope):, etc.)just teston the tests for the code I changed, and they passjust checkpasses (the blocking lint and code-health checks CI runs)Documentation & Housekeeping
docs/, docstrings) — N/Acli-config.yaml.exampleif I added/changed config keys — N/ACONTRIBUTING.mdorAGENTS.mdif I changed architecture or workflows — N/A🤖 Generated with Claude Code