Skip to content

fix: leave Enter and Escape to an IME composition in rename and folder fields - #698

Open
wonjangcloud9 wants to merge 1 commit into
amosblomqvist:mainfrom
wonjangcloud9:fix/ime-composition-commit-fields
Open

wonjangcloud9 wants to merge 1 commit into
amosblomqvist:mainfrom
wonjangcloud9:fix/ime-composition-commit-fields

Conversation

@wonjangcloud9

@wonjangcloud9 wonjangcloud9 commented Nov 12, 2026 •

Copy link
Copy Markdown

Problem

Several fields act on Enter or Escape without checking for an IME composition, so Japanese, Chinese and Korean input ends or cancels them early:

  • Session rename in the sidebar (RenameRow), the chat title rename (chat.tsx), source/folder naming in the Chains overlay (source-folder-tree.tsx), the sidebar session search, and the allowed-folder field in Settings → Agent.
  • A Japanese Enter that only confirms a conversion commits the unconverted text and closes the field.
  • A Japanese Escape that cancels a conversion discards the edit, or the whole new folder.

PathInput, session find and the side thread already skip composing keys. These fields didn't.

Change

Each handler returns early while the key belongs to a composition (event.nativeEvent.isComposing || event.keyCode === 229), the same check PathInput uses. In the folder field the composing key also stops propagation, like PathInput. After the composition ends, Enter and Escape behave as before.

The window-level Escape chain (interaction-layers) already ignores composing keys, so returning early doesn't let a composing Escape close the overlay or abort a turn. The browser check below confirms that for the Chains overlay.

Verification

Browser. I ran npm run dev with an empty LH_DATA_DIR and {} auth, seeded one chat through POST /api/chats, and replayed the key sequences Chrome on macOS delivers. I used puppeteer + CDP (Input.imeSetComposition, Input.insertText, Input.dispatchKeyEvent with keyCode 229), not a physical IME. Same server, main's components vs this branch (hot reload):

Scenario main this branch
Chat title: compose きょう, Enter to convert to 今日, keep typing の復習, Enter rename closes on the conversion Enter, title saved as "きょう" stays open, title saved as "今日の復習"
New folder in Chains: 復習 + composing ふくしゅう, Escape to cancel the conversion the new folder is discarded field stays open with "復習"; overlay stays open
Chat title, Korean: 복습 노 + composing 트, Enter (229) then Enter (13) saved "복습 노트" saved "복습 노트"

Korean didn't misbehave in the chat title. The rename closes on the first Enter, but the value already holds the composing syllable. The Japanese cases are the visible failures.

Tests. I added tests/session-rename-ime.test.tsx and tests/source-name-ime.test.tsx. In both, a composing Enter and a composing Escape leave the field open and a plain Enter still commits. Both fail on main and pass here. linkedom doesn't dispatch to window, so the overlay part is covered by the browser check, not these tests.

npm test passes: 5271 tests, 0 failures. One earlier run had a single timing-related failure that didn't recur. ESLint is clean apart from the <head> warning that source-name-ui.test.tsx also has. tsc --noEmit reports nothing in the changed files. Its remaining errors are under plugins/, from my checkout's plugin setup.

I didn't drive the session search or the allowed-folder field in the browser. Their change is the same one-line guard.

🤖 Generated with Claude Code

…r fields

Session rename (sidebar), the chat title rename, source/folder naming in
the Chains overlay, the sidebar session search and the allowed-folder
field acted on Enter and Escape without checking for an IME composition.
A Japanese Enter that only confirms a conversion committed the
unconverted text and closed the field (a title typed as きょう -> 今日 was
saved as "きょう"), and a Japanese Escape that cancels a conversion
discarded a new folder.

Each handler now returns early while the key belongs to a composition
(`isComposing` or keyCode 229), as PathInput, session find and the side
thread already do. The folder field also stops propagation for those
keys, like PathInput.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

1 participant