Repository navigation
Studio: guard project chat rename against IME composition keys - #7246
Conversation
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.
There was a problem hiding this comment.
Code Review
This pull request refactors the onKeyDown handler in the chat page component to guard against keydown events fired during IME composition before checking specific keys like "Enter". This prevents candidate-confirming or candidate-cancelling actions from prematurely committing or cancelling a rename. The reviewer suggested using React's synthetic event.isComposing directly instead of accessing event.nativeEvent.isComposing to simplify the code and avoid potential runtime errors in test environments.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| if ( | ||
| event.nativeEvent.isComposing || | ||
| event.keyCode === 229 | ||
| ) | ||
| return; |
There was a problem hiding this comment.
In React, the isComposing property is directly available on the Synthetic KeyboardEvent (i.e., event.isComposing). Reaching into event.nativeEvent is unnecessary and can occasionally lead to runtime errors in testing environments where nativeEvent might not be fully mocked. Additionally, simplifying this to a single-line conditional matches the existing codebase style for guard clauses.
if (event.isComposing || event.keyCode === 229) return;
There was a problem hiding this comment.
isComposing is not exposed on React's SyntheticKeyboardEvent (react/react#13104), so event.isComposing is undefined at runtime. event.nativeEvent.isComposing is the required access and is what guards WebKit here; switching would drop the Safari IME guard and leave only the Chromium keyCode 229 path. Keeping as is.
|
@codex review |
|
Codex Review: Didn't find any major issues. Nice work! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Problem
Follow-up to #7005. The project chat rename input guarded only the Enter that confirms an IME candidate, so on WebKit an Escape that cancels a candidate mid-composition also cancelled the rename. Composing a CJK title and pressing Escape to drop a candidate would lose the edit.
Fix
Move the composition guard ahead of the key branch so both Enter and Escape are ignored while a candidate is being composed (
isComposingon WebKit, keyCode 229 on Chromium). Non-IME input is unchanged: a real Enter still commits and a real Escape still cancels.Verification
Checked against the rename state machine: while composing, neither Enter nor Escape commits or cancels; outside composition both behave as before. Frontend only, scoped to the rename input.
Compatibility
No behaviour change for non-IME input; only reorders where the existing composition check runs.