From 127c69bcbba61f17dffee6f3adb54cda5e737e05 Mon Sep 17 00:00:00 2001 From: Daniel Han Date: Thu, 23 Jul 2026 00:45:28 -0700 Subject: [PATCH] Studio: guard project chat rename against IME composition keys (#7246) The rename input only ignored the composition-confirming Enter, so on WebKit an Escape that cancels an IME candidate also cancelled the rename. Move the composition guard ahead of the key branch so both Enter and Escape are ignored while a CJK candidate is being composed. --- studio/frontend/src/features/chat/chat-page.tsx | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/studio/frontend/src/features/chat/chat-page.tsx b/studio/frontend/src/features/chat/chat-page.tsx index 3daae8c50d..16176f0f5f 100644 --- a/studio/frontend/src/features/chat/chat-page.tsx +++ b/studio/frontend/src/features/chat/chat-page.tsx @@ -1395,9 +1395,17 @@ function ProjectLanding({ setRenameDraft(event.target.value) } onKeyDown={(event) => { + // Ignore keydowns fired mid-IME-composition (CJK) + // so a candidate-confirming Enter or candidate- + // cancelling Escape does not commit/cancel the + // rename. Guard before the key branch so Escape is + // covered too (isComposing on WebKit, 229 on Chromium). + if ( + event.nativeEvent.isComposing || + event.keyCode === 229 + ) + return; if (event.key === "Enter") { - if (event.nativeEvent.isComposing || event.keyCode === 229) - return; event.preventDefault(); skipRenameBlurRef.current = true; void commitRename(item);