Skip to content

fix(app): guard keydown handlers against IME composition events#20888

Closed
ysm-dev wants to merge 1 commit into
anomalyco:devfrom
ysm-dev:fix/ime-composing-guard
Closed

fix(app): guard keydown handlers against IME composition events#20888
ysm-dev wants to merge 1 commit into
anomalyco:devfrom
ysm-dev:fix/ime-composing-guard

Conversation

@ysm-dev
Copy link
Copy Markdown
Contributor

@ysm-dev ysm-dev commented Apr 3, 2026

Issue for this PR

Closes #20850

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

When typing with an IME (Korean, Japanese, Chinese), keydown events fire with isComposing: true while the user is composing characters. Several keydown handlers in the codebase didn't check this property, causing two classes of bugs:

  1. Keybind leakage: Pressing cmd+' during IME composition opened the model select dialog, and the last composed character leaked into the dialog's search input (because the composition was forcibly interrupted and the character committed into the newly auto-focused input).

  2. Premature Enter handling: Pressing Enter to confirm an IME candidate (e.g. selecting a Korean syllable) was intercepted by keydown handlers and treated as a form submission — saving inline editors, submitting custom answers, or jumping to the next search result instead of committing the composed character.

The fix adds if (event.isComposing) return guards to 7 keydown handlers:

  • command.tsx — global keybind dispatcher (fixes cmd+', cmd+k, cmd+p, etc.)
  • message-timeline.tsx — session title inline editor (Enter to save)
  • inline-editor.tsx — file tree / generic inline editor (Enter to save)
  • session-sortable-terminal-tab.tsx — terminal tab rename input (Enter to save)
  • session-question-dock.tsx — custom answer textarea (Enter to submit) + nav handler (Escape/Cmd+Enter)
  • session.tsx — session page global handler (Escape to blur, auto-focus on keypress)
  • file-find.ts — file search input (Enter to next match)

This is the same pattern already used in list.tsx, use-filtered-list.tsx, line-comment.tsx, and prompt-input.tsx.

How did you verify your code works?

  • Typed Korean text in the prompt input, pressed cmd+' — model select dialog opens with an empty search input (no leaked character)
  • Typed Korean in session title inline editor, pressed Enter to confirm IME candidate — character committed normally, title not saved prematurely
  • Typed Korean in file search input, pressed Enter to confirm IME — character committed, no jump to next match

Screenshots / recordings

N/A — behavioral fix for IME input, no visual change

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@rekram1-node
Copy link
Copy Markdown
Collaborator

Automated PR Cleanup

Thank you for contributing to opencode.

Due to the high volume of PRs from users and AI agents, we periodically close older PRs using automated criteria so maintainers can focus review time on the most active and community-supported contributions.

This PR was closed because it matched the following cleanup criteria:

  • The PR was created more than 1 month ago
  • The PR had fewer than 2 positive reactions
  • Positive reactions are counted as thumbs-up, heart, celebration, or rocket reactions on the PR

PRs created within the last month are not affected by this cleanup.

If you believe this PR was closed incorrectly, or if you are still actively working on it, please leave a comment explaining why it should be reopened. A maintainer can review and reopen it if appropriate.

Thanks again for taking the time to contribute.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Question dock custom answer textarea submits on IME composition Enter

2 participants