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.
This commit is contained in:
Daniel Han 2026-07-23 00:45:28 -07:00 committed by GitHub
commit 127c69bcbb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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);