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:
parent
fa5498db0b
commit
127c69bcbb
1 changed files with 10 additions and 2 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue