Skip to content

fix(web): map search keeps IME Enter and Escape on the input - #43684

Merged
juliusmarminge merged 2 commits into
pingdotgg:mainfrom
2SinceJuly:fix/43621-map-search-esc
Nov 26, 2026
Merged

juliusmarminge merged 2 commits into
pingdotgg:mainfrom
2SinceJuly:fix/43621-map-search-esc

Conversation

@2SinceJuly

Copy link
Copy Markdown
Contributor

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 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/web typecheck 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.
@github-actions github-actions Bot added vouch:unvouched Author is not yet trusted in the VOUCHED list. size:S 10-29 changed lines (additions + deletions). labels Nov 26, 2026
@coderabbitai

coderabbitai Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Important

Review skipped

Review was skipped as selected files did not have any reviewable changes.

Run configuration

Commits

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.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Low

Suggested reviewers: juliusmarminge, only21mil

Merge Risk: Minimal · previous review ff69a

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: Passed 4

Check name Status Explanation
Title check Passed 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 Passed 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 Passed 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 Passed 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
Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 83d4509 and ff69a53.

Files selected for processing: 2

  • apps/web/src/components/settings/EnvironmentsMap.browser.test.tsx
  • apps/web/src/components/settings/EnvironmentsMap.tsx

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

@juliusmarminge juliusmarminge added the takeover:in-progress A takeover lead is working on this PR label Nov 26, 2026
@juliusmarminge

Copy link
Copy Markdown
Member

Evidence

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.

Step Before After
Commit d6061ec8ad 0f1f5c1dc4
Composition Enter Before: machine selected After: machine unselected
Enter, keyCode 229 Before: machine selected After: machine unselected
Composition Escape Before: query cleared After: query preserved
Escape, keyCode 229 Before: query cleared After: query preserved
Ordinary Enter selects Before: selected After: selected
Ordinary Escape clears Before: cleared After: cleared
Second Escape closes Before: Settings closed After: Settings closed
Recording Before interaction After interaction

Scenario driver

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.

@juliusmarminge juliusmarminge added takeover:ready Takeover done; auto-lands when gates pass and removed takeover:in-progress A takeover lead is working on this PR labels Nov 26, 2026
@juliusmarminge
juliusmarminge merged commit 9022118 into pingdotgg:main Nov 26, 2026
57 checks passed
@juliusmarminge juliusmarminge removed the takeover:ready Takeover done; auto-lands when gates pass label Nov 26, 2026
github-actions Bot pushed a commit to Ryoku-dev/hyakki that referenced this pull request Nov 26, 2026
…gg#43684)

Co-authored-by: Julius Marminge <julius0216@outlook.com>
(cherry picked from commit 9022118)
github-actions Bot pushed a commit to Ryoku-dev/hyakki that referenced this pull request Nov 26, 2026
…gg#43684)

Co-authored-by: Julius Marminge <julius0216@outlook.com>
(cherry picked from commit 9022118)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:S 10-29 changed lines (additions + deletions). vouch:unvouched Author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Environments map machine search clears on IME Escape and closes Settings on held Escape

2 participants