Repository navigation
fix(terminal): keep ime tab from accepting completions - #7203
Conversation
Design Review (Fable 5, fork) — ✅ PASSDesign-level review of The diff is small and I've read the surrounding handler. The change extends the established IME grace-window pattern (merged for Enter in #7000) to Tab at the single key-ownership choke point, with the asymmetry (Enter passes through, Tab is fully consumed) explicitly justified: a leaked Tab reaches the PTY as shell completion and rewrites the line, which is the harm. The grace check deliberately precedes the menu-open check so Tab can't escape to xterm even with no menu — matching the stated problem. Tests pin both the negative (grace-window Tab consumed, no bytes sent) and the positive control (Tab completes after the window), with red-before evidence. The "Manual verification: N/A" rests on a browser premise ( Design-Verdict: PASS A real CJK-IME harm, fixed at the one key-ownership choke point by extending the already-merged Enter grace-window contract, with bidirectional regression pins. [DESIGN-REVIEWED] 4a5ea83 |
Opus 4.8 Review (fork) — ✅ no blocking findingsReviewed Review detailsNo findings. The sole candidate requires a modifier-held Tab (Ctrl/Alt/Meta+Tab) arriving within the 60ms [OPUS-REVIEWED] 4a5ea83 |
GPT 5.6 Review (fork) — ✅ no blocking findingsReviewed Review detailsNo findings. |
UX Review (Fable 5, fork) — ✅ PASSUX-level review of No attachments and no recordings exist for this PR — consistent with its declared UX-Verdict: PASS Invisible keyboard-ownership fix: no rendered UI, string, or control changes; it stops IME candidate keys from rewriting the user's command line. [UX-REVIEWED] 4a5ea83 |
First Principles Review (Fable 5, fork) — ✅ PASSPremise-level review of The change checks out against the base: Enter-only grace handling at First-Principles-Verdict: PASS Only manual check left: on a real IME, a wanted shell-completion Tab typed within 60ms of a commit is swallowed — confirm that trade is acceptable. What this change shipsInventory (4 items) — 4 justifiedIntent: stop either completion layer from rewriting an IME user's command line when Tab commits or navigates a candidate — a FIX.
The defect is readable on base ( [FIRST-PRINCIPLES-REVIEWED] 4a5ea83 |
Open PR relationship auditThis is a consolidated, point-in-time code-level audit note. It compares complete merge-base diffs and current/merged code; it does not treat a shared topic as duplication or partial coverage as completion. Relationship findings
No PR, Issue, label, branch, or review state was changed by the relationship-note portion of this audit. |
|
🤖 Kiro Crew [operator: NicholasRBowers#a942f9ca]: This PR has been inactive for 7+ days with PR Readiness stuck pending. I've assessed the blockers and they appear resolvable — I'll push fixes directly to this branch as a co-author. Assessment: CI is fully green on head If you'd prefer I don't touch this PR, add the |
633e870 to
4a5ea83
Compare
|
🤖 Kiro Crew [operator: NicholasRBowers#a942f9ca] Rebase-only push: Why: all CI was green on Verified locally on the rebased head: |
|
🤖 Kiro Crew [operator: NicholasRBowers#a942f9ca] Body-only edit: added the Status otherwise: all five Stage-2 review lanes stamped the new head |
iamwhatever
left a comment
There was a problem hiding this comment.
Tier 1 auto-approve: fix (2 files). Criteria: no conflict, no requested changes, security path denylist clean, design-doc gate clean, SAST annotations clean, security checklist all-NO, AI reviewers green. Category: IME grace window let Tab reach both the completion menu and xterm; the handler now consumes Tab inside the window while Enter keeps its pass-through, with two regression tests. CodeQL is not applicable on this fork PR (default-setup emits no check-run); SAST coverage is Semgrep only, latest run success with 0 annotations.
* fix(terminal): keep ime tab from accepting completions * fix(terminal): consume IME tab after composition
Problem / Motivation
Terminal completion already leaves Enter alone during the short window after an
IME composition ends, but Tab did not have the full choose-key contract. Accepting
Tab in that window rewrote the command with a menu suggestion; merely returning it
to xterm instead sent Tab to the PTY and triggered shell completion.
Why it matters
People typing with a Chinese, Japanese, or Korean IME can have their terminal
command line rewritten by either UI completion layer when they are only committing
or navigating an IME candidate.
What changed (motivation → approach → change)
The terminal tracks
compositionendbecause browser native composition flags mayalready be clear on the committing keydown. A Tab with live native composition
flags is still left to the browser/IME. During the post-composition grace window,
after those flags clear, Tab is now claimed and consumed: the completion menu does
not accept it, xterm does not pass it to the PTY, and the browser default is
prevented. Existing Enter behavior is unchanged, and ordinary Tab completion still
works after the grace window expires.
Tests
menu, is not passed to xterm/PTY, has its default action prevented, and sends no
completion bytes.
npm exec -- vitest run src/test/TerminalCompletion.test.tsx --coverage.enabled=false— 65 passed.
useImeGuard.documentLatchandImeEnterGuardSites) — 37 passed.npm exec -- tsc -b --pretty false— passed.Red-before on PR head
22ca20622441ef84706b988303466d2ef903aaeb:1 failed / 64 passed; the regression observed that post-composition Tab returned
trueto xterm. Green-after on current head: 65 / 65 passed.Manual verification
N/A — the focused component harness deterministically drives xterm's custom key
handler, composition-end event, fake clock, DOM cancellation state, and PTY-write
seam.
Screenshots / video
Why no screenshot: This changes keyboard-event ownership during IME composition;
the rendered terminal completion UI is unchanged.
Related Issues
no linked issue: this is the exact unfixed sibling named by merged PR #7000's
first-principles review.
Checklist
feat|fix|docs|refactor|perf|test|chore|ci|build|revert: ...)Pattern harvest
Rule candidate: any
keydownhandler that routes committing keys (Enter/Tab) must honor the IME composition boundary — checke.isComposing || e.keyCode === 229AND the post-compositionendgrace window before treating the key as a UI command; a handler readinge.keyalone misroutes a just-committed IME candidate.