You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(web): map search keeps IME Enter and Escape on the input - #43684
The Find a machine search on the Settings → Connections map is a native type="search" input whose keydown handler never checks IME composition. Two of the three escape/IME problems in #43621 reproduce on main (44a5333786):
Escape during composition clears the query. A native search input clears itself on an Escape that cancels an IME composition, and the handler also runs setQuery("") for it. After that cleared query the same Escape bubbles to the Settings modal and closes it, so cancelling a composition loses the search and leaves Settings.
Enter during composition jumps to the first match. With the query set, a keydown of Enter carrying keyCode === 229 (the Safari confirmation) reaches goToFirstMatch() and selects the first result, instead of the IME taking the key.
The sibling stack filter (EnvironmentsMapDetails.tsx, #43149) and the ignored-file search (AddProjectToMachineDialog.tsx, #43559) already fixed both; this is the third input of the same shape.
While probing, the third item of #43621 — holding Escape closing Settings after the query was cleared — did not reproduce: AppRouteModal already cancels held escape-key repeats, and a repeated Escape on this input leaves Settings open on main. That item needs no change here.
Change
The input is a type="text" field with role="searchbox" and enterKeyHint="search", so the browser no longer clears it on its own.
onKeyDown returns early (stopping propagation) for isComposing || keyCode === 229, so Enter and Escape that belong to an IME are left to the IME and never reach the map or the modal.
A real Escape still clears the query and stops propagation, so Settings stays open; a second Escape closes Settings.
Scope
Fixes#43621. Bug fix only: no behavior change beyond the IME guard and the input's native-clear regression, and nothing here is a feature.
Verification
Red on main, green on the branch. The new case in EnvironmentsMap.browser.test.tsx mocks one machine (Desk) so a search can reach a node that is not this browser.
On unmodified main: fails at toHaveValue("Desk") — the composed Escape emptied the query. With the type assertion kept, it fails there first.
Isolating the two halves of the fix:
IME guard alone, still type="search": still fails at data-open — the composed Escape closed Settings.
Full fix minus the stopPropagation on a real Escape: still fails at data-open.
Full fix: passes.
On main, an Enter with keyCode === 229 selects Desk (aria-pressed="true"); on the branch an IME Enter leaves it unselected and an ordinary Enter still selects it (asserted both ways).
vp test run apps/web/src/components/settings/EnvironmentsMap.browser.test.tsx → 5 passed.
vp check on both files passes; apps/webtypecheck reports no errors.
No screenshots: the change is keyboard/IME handling, and the visible control (a search box with the same label and placeholder) is unchanged.
Model: Claude Code (Claude Sonnet 5), which wrote the test and fix; I ran the red/green checks above and verified the held-Escape claim against main.
The Find a machine field on the Settings environments map was a native
type=search input. Escape clears those during IME composition, and the
keydown handler ran Enter and Escape without checking composition, so a
candidate-confirming Enter jumped to the first match. Setting Escape
also let the cancelled composition bubble to the Settings modal, which
closed it instead of only clearing the query.
Match the stack filter and Add to another machine fixes: a text input
with role=searchbox, and Enter/Escape that belong to an IME are left to
the IME. The search keeps its own Escape.
Reviewing files that changed from the base of the PR and between ff69a53 and 0f1f5c1.
You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.
Use the checkbox below for a quick retry:
Trigger review
No actionable comments were generated in the recent review.
Walkthrough
The environments map search input now uses text input semantics and ignores Enter and Escape events during IME composition. Browser tests cover composing events, machine selection, clearing the query, and closing Settings.
Changes: Environment search keyboard handling
Layer / File(s)
Summary
Search input and keyboard behavior apps/web/src/components/settings/EnvironmentsMap.tsx, apps/web/src/components/settings/EnvironmentsMap.browser.test.tsx
The search field uses type="text", role="searchbox", and enterKeyHint="search". Its handler stops propagation and returns for composing events or key code 229. Browser tests check that composing Enter and Escape do not select a machine or alter Settings, and that regular Enter and Escape retain their described behavior.
The Find a machine field now ignores Enter and Escape during IME composition and keeps regular Escape behavior. No concrete merge-blocking risk was identified.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title names the main change: the map search input keeps IME Enter and Escape events instead of letting them trigger map selection or close Settings. It follows the conventional commit format and m…
Description check
The description follows the template sections: Problem, Change, Scope, and Verification. It explains the bug and reproduction on main, and gives the fix in terms of the input type change and the IME g…
Linked Issues check
Directly linked issue #43621 has three coding requirements for the "Find a machine" input in EnvironmentsMap.tsx. (1) Input type and attributes: the diff changes type="search" to type="text", adds rol…
Out of Scope Changes check
The source change in EnvironmentsMap.tsx is limited to the Find a machine input: its type, role, enterKeyHint, the composition guard in onKeyDown, and an added preventDefault() on the Escape-clear bra…
Full details: Title check
Explanation
The title names the main change: the map search input keeps IME Enter and Escape events instead of letting them trigger map selection or close Settings. It follows the conventional commit format and matches the changeset (input type change, IME guard, and stopPropagation in EnvironmentsMap.tsx). It does not mention the input type change or the held-Escape check, which is expected for a short title.
Full details: Description check
Explanation
The description follows the template sections: Problem, Change, Scope, and Verification. It explains the bug and reproduction on main, and gives the fix in terms of the input type change and the IME guard. It links issue #43621 and states the bug-fix scope. Verification includes specific test runs, red/green results, and a note on why no screenshots were included. The template asks for before/after screenshots for UI changes. The author justifies skipping them because the visible control is unchanged, and the model and harness are named at the end, as the template asks. The description is complete enough to pass.
Full details: Linked Issues check
Explanation
Directly linked issue #43621 has three coding requirements for the "Find a machine" input in EnvironmentsMap.tsx. (1) Input type and attributes: the diff changes type="search" to type="text", adds role="searchbox" and enterKeyHint="search". This matches the issue's expected attributes. (2) IME handling: onKeyDown now returns early with stopPropagation() when event.nativeEvent.isComposing or event.keyCode === 229. Enter and Escape during composition therefore do not call goToFirstMatch() or clear the query. (3) Escape handling: a non-composing Escape with a non-empty query calls preventDefault(), stopPropagation(), and setQuery(""), so Settings stays open. Held-Escape requirement: AppRouteModal.tsx at the merge base already cancels onOpenChange for reason "escape-key" when event.repeat is true. Repeated Escape keydowns therefore do not close Settings, and a plain Escape on an empty query still closes it. This requirement is met by existing code, so the PR does not need to add a guard. The browser test case in EnvironmentsMap.browser.test.tsx covers the composed Escape and Enter behavior; I did not re-run it. All linked requirements are coding requirements and are addressed.
Full details: Out of Scope Changes check
Explanation
The source change in EnvironmentsMap.tsx is limited to the Find a machine input: its type, role, enterKeyHint, the composition guard in onKeyDown, and an added preventDefault() on the Escape-clear branch. Each change serves #43621. The preventDefault() call prevents native search clearing, which the type change also addresses. The added comment explains the native-clear behavior. The browser test file (per the summary) adds coverage for the same IME and Escape behavior. No unrelated files or behavior changes were identified in the reviewed evidence. The PR description states that no other behavior changes are intended.
Finishing Touches
Generate unit tests (beta)
Create a new PR
Fix failing CI checks
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
Real web app, Chromium, 1280×800, light theme, fresh synthetic state. Search for Scenario; send scripted composition Enter/Escape using both isComposing and keyCode 229, resetting between cases. Then verify ordinary Enter selects, Escape clears, and another Escape closes Settings. Composition events were scripted; native OS IME and Safari were not exercised.
The scenario failed on base and passed on head. Base reproduced unwanted selection and query clearing; composition Escape did not close Settings in this run.
Not shown:
Native Japanese or Chinese IME candidate confirmation/cancellation was not exercised; the real app received scripted composition and keyboard events.
Safari itself was not run; keyCode 229 with isComposing=false was exercised in Chromium.
The reported composition Escape dismissal of Settings was not reproduced; base cleared the query but kept Settings open.
Desktop Electron was not exercised; evidence covers the web client.
…gg#43684)
Co-authored-by: Julius Marminge <julius0216@outlook.com>
(cherry picked from commit 9022118)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
size:S10-29 changed lines (additions + deletions).vouch:unvouchedAuthor is not yet trusted in the VOUCHED list.
2 participants
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The Find a machine search on the Settings → Connections map is a native
type="search"input whose keydown handler never checks IME composition. Two of the three escape/IME problems in #43621 reproduce onmain(44a5333786):setQuery("")for it. After that cleared query the same Escape bubbles to the Settings modal and closes it, so cancelling a composition loses the search and leaves Settings.keydownof Enter carryingkeyCode === 229(the Safari confirmation) reachesgoToFirstMatch()and selects the first result, instead of the IME taking the key.The sibling stack filter (
EnvironmentsMapDetails.tsx, #43149) and the ignored-file search (AddProjectToMachineDialog.tsx, #43559) already fixed both; this is the third input of the same shape.While probing, the third item of #43621 — holding Escape closing Settings after the query was cleared — did not reproduce:
AppRouteModalalready cancels heldescape-keyrepeats, and a repeated Escape on this input leaves Settings open onmain. That item needs no change here.Change
type="text"field withrole="searchbox"andenterKeyHint="search", so the browser no longer clears it on its own.onKeyDownreturns early (stopping propagation) forisComposing || keyCode === 229, so Enter and Escape that belong to an IME are left to the IME and never reach the map or the modal.Scope
Fixes #43621. Bug fix only: no behavior change beyond the IME guard and the input's native-clear regression, and nothing here is a feature.
Verification
Red on
main, green on the branch. The new case inEnvironmentsMap.browser.test.tsxmocks one machine (Desk) so a search can reach a node that is not this browser.main: fails attoHaveValue("Desk")— the composed Escape emptied the query. With thetypeassertion kept, it fails there first.type="search": still fails atdata-open— the composed Escape closed Settings.stopPropagationon a real Escape: still fails atdata-open.main, an Enter withkeyCode === 229selectsDesk(aria-pressed="true"); on the branch an IME Enter leaves it unselected and an ordinary Enter still selects it (asserted both ways).vp test run apps/web/src/components/settings/EnvironmentsMap.browser.test.tsx→ 5 passed.vp checkon both files passes;apps/webtypecheckreports no errors.No screenshots: the change is keyboard/IME handling, and the visible control (a search box with the same label and placeholder) is unchanged.
Model: Claude Code (Claude Sonnet 5), which wrote the test and fix; I ran the red/green checks above and verified the held-Escape claim against
main.