fix(web): keep thread rename open during IME composition - #6281
fix(web): keep thread rename open during IME composition#6281MichaelCharles wants to merge 1 commit into
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Both thread rename inputs committed on any Enter keydown, including the Enter that confirms an IME candidate. Renaming a thread with a Japanese, Chinese, or Korean IME therefore saved the title mid-compose and closed the input, truncating everything not yet converted: typing かいけい and pressing Enter to pick 会計 saved the thread as "会計" with no way to finish the intended title. Guard both handlers with the composition check the thread search input in Sidebar.tsx already uses, so Enter reaches the IME while a candidate is pending and only commits once composition has ended. isComposing alone is not sufficient because some platform and IME combinations leave it false mid-composition while keyCode stays 229. Refs pingdotgg#6280
ApprovabilityVerdict: Approved d918691 This PR adds standard IME composition handling to prevent Enter key from incorrectly committing thread rename during character composition. The fix uses a well-established pattern, is minimal in scope, and has no side effects. You can customize Macroscope's approvability policy. Learn more. |
72a8d92 to
d918691
Compare
Dismissing prior approval to re-evaluate d918691
What Changed
Both thread rename inputs now ignore
keydownwhile an IME composition is in flight:apps/web/src/components/Sidebar.tsx— sidebar inline renameapps/web/src/components/chat/ChatHeader.tsx— header breadcrumb renameThe guard is the one the thread search input in
Sidebar.tsxalready uses:Two files, one added line each, no new abstraction and no behavior change for non-IME input.
Why
Fixes #6280.
Both handlers committed the rename on any
Enterkeydown. With a Japanese, Chinese, or Korean IME,Enteris also how you confirm a conversion candidate — so that firstEntercommitted the title mid-compose and closed the input, discarding everything not yet converted.Concretely: typing
かいけいand pressingEnterto select会計saved the thread as会計, with no way to reach the intended会計 ARM support. The only workaround was renaming repeatedly, one converted word at a time.isComposingalone is not sufficient — some platform/IME combinations leave itfalsemid-composition whilekeyCodestays229— which is why the existing guard in this repo checks both and why this change matches it rather than inventing a new predicate. It also explains why this reproduces on macOS with the Japanese input source but not on Windows with Microsoft IME: whether the confirmingEnterreaches the input as a page-level keydown varies by OS, browser, and IME.Deliberately left alone:
handleRenameBlurstill commits on blur, and non-compositionEnter/Escapebehave exactly as before.UI Changes
No visual change — the input, styling, and layout are untouched. The difference is purely in when
Entercommits.Before: https://github.com/user-attachments/assets/6f097a5b-31d2-461c-a80a-a3f1d6e5c333
After: https://github.com/user-attachments/assets/1b2da9a2-5126-4895-a728-83235c17090e
Verification
Targeted checks only, per
AGENTS.md:vp linton both touched files — cleanvp fmt --checkon both touched files — cleanvp run --filter @t3tools/web typecheck— cleanvp test run ChatHeader.test.ts Sidebar.logic.test.ts Sidebar.snooze.test.ts— 3 files, 114 tests passedNo test was added. The keydown handlers are inline in their components, so covering this would mean extracting a predicate and exporting it; that felt like more machinery than a two-line guard warrants, especially with four inline instances of this same pattern already in the codebase. Happy to extract and test it if you would rather have the regression guard.
Checklist
Note
Fix thread rename inputs to ignore Enter/Escape during IME composition
Adds an early return in
handleRenameKeyDownin both Sidebar.tsx and ChatHeader.tsx whenevent.nativeEvent.isComposingis true orevent.keyCode === 229, preventing Enter/Escape from committing or cancelling a rename while the user is mid-composition with an IME.Macroscope summarized d918691.
Note
Low Risk
Tiny UI keydown guard in rename inputs only; no auth, data, or API changes, and non-IME behavior is preserved.
Overview
Prevents thread rename from committing mid-IME composition when Enter confirms a Japanese/Chinese/Korean candidate.
Adds the existing
isComposing/keyCode === 229guard tohandleRenameKeyDownin bothSidebar.tsxandChatHeader.tsx, matching the pattern already used by thread search. Non-IME Enter/Escape and blur commit behavior are unchanged.Reviewed by Cursor Bugbot for commit 72a8d92. Bugbot is set up for automated code reviews on this repo. Configure here.