Skip to content

fix(web): pressing Escape on the Environments map clears selection without closing Settings - #43017

Merged
juliusmarminge merged 2 commits into
pingdotgg:mainfrom
only21mil:fix/web-environments-map-escape-keeps-settings-open
Nov 25, 2026
Merged

juliusmarminge merged 2 commits into
pingdotgg:mainfrom
only21mil:fix/web-environments-map-escape-keeps-settings-open

Conversation

@only21mil

Copy link
Copy Markdown
Contributor

Problem

When a machine, link or stack is selected on the Environments map (Settings → Connections → Environments) and Escape is pressed, the whole Settings dialog closes instead of only clearing the selection. The map's canvas lets Escape bubble to the dialog's document-level listener, and the details panel, which keeps focus after choosing a machine or link inside it, does not handle Escape.

Change

While something is selected, the canvas handles Escape and stops propagation, as the map's search field already does. The details panel does the same when the panel itself has focus, so Escape inside its fields and menus keeps its current behavior. With nothing selected, Escape bubbles as before, so a second Escape still closes Settings. Safari does not focus a clicked button, so a click on a map control now focuses it, as Chrome already does.

Scope

Small fix of an obvious bug (one Escape closes the dialog), so no issue. The map is web-only UI; desktop uses the same web UI, and mobile has no Environments map. Clicking a link's line (not its label) still leaves focus outside the map, as before, so Escape there closes Settings; making the canvas focusable is a separate change.

Verification

Setup: T3 web app from source (dev runner), Browser panel 2560x1600, light theme, isolated unseeded dev data (server labelled "Test machine").

Steps: open Settings → Connections → Environments (Map view) → click the Test machine node (its details show below the map) → press Escape.

e242ed0e1ac (before) 3d31e84da17 (after)
On e242ed0e1ac one Escape with Test machine selected closes Settings.
On e242ed0 one Escape with Test machine selected closes Settings.
On 3d31e84da17 the same Escape returns the details to "1 machine" and Settings stays open.
On 3d31e84 the same Escape returns the details to "1 machine" and Settings stays open (the ring is keyboard focus).

With Test machine selected and focus on the details panel (click its empty area), Escape on 3d31e84 also keeps Settings open:

On 3d31e84da17 Escape from the focused details panel clears the selection and Settings stays open.

An AI agent ran these checks. On 3d31e84 a second Escape closes Settings in both cases. EnvironmentsMap.browser.test.tsx renders the map inside the Settings dialog and covers Escape from the map, from the details panel, and after a click that does not move focus (as in Safari). All three pass in 3 of 3 runs and fail with e242ed0's map files; removing only the click focus, or only the details change, fails its own case. In the Browser panel with click focus blocked, Escape also kept Settings open. vp run check:changed exits 0.

Not shown:

  • Escape with a link or a stack selected (same handlers).
  • Safari itself (simulated by blocking click focus).
  • Desktop (same web UI).

Generated with Claude Opus 5.5 in T3 Code Nightly

@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 25, 2026
@github-actions

Copy link
Copy Markdown
Contributor

This PR changes the test suite by +3 test cases (browser +3, unit 0, server 0).

New browser test files: apps/web/src/components/settings/EnvironmentsMap.browser.test.tsx.
Each browser test file costs CI seconds of module loading before its first test runs; a unit test costs milliseconds.

Keep tests that would fail for a real reason, and test logic below the UI where it can be. See Testing.

@coderabbitai

coderabbitai Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Escape clears an existing map selection without closing Settings. The Details panel also handles Escape when it is the event target. Clicking a map item focuses its button. Browser tests cover these interactions.

Changes: Settings environment map keyboard behavior

Layer / File(s) Summary
Selection clearing and focus behavior
apps/web/src/components/settings/EnvironmentsMap.tsx, apps/web/src/components/settings/EnvironmentsMapDetails.tsx, apps/web/src/components/settings/EnvironmentsMap.browser.test.tsx
Escape clears an existing selection and stops propagation in the map and Details panel. Clicking a map item focuses its button without scrolling. Browser tests check selection clearing and Settings dialog behavior.

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

Change: Bug fix

Suggested reviewers: juliusmarminge

Merge Risk: Minimal · up to f5bbf

Merge Risk: ⚪ Minimal · up to f5bbf

Pressing Escape on the Environments map now clears a selection without closing Settings, and a second Escape closes it. The change is small and local to the map UI, and browser tests cover the main interactions. Merge risk is low.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: Escape on the Environments map now clears the selection instead of closing Settings. It matches the raw summary, which describes Escape clearing the map selection and …
Description check Passed The description follows the template sections: Problem, Change, Scope, and Verification. The Problem section gives the bug and its cause. The Change section explains the canvas and details-panel Escap…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the main change: Escape on the Environments map now clears the selection instead of closing Settings. It matches the raw summary, which describes Escape clearing the map selection and stopping propagation in FleetCanvas and FleetDetails. It uses the conventional commit form, and it is specific enough for a teammate to scan history.

Full details: Description check

Explanation

The description follows the template sections: Problem, Change, Scope, and Verification. The Problem section gives the bug and its cause. The Change section explains the canvas and details-panel Escape handling and the click-focus change. The Scope section explains why no issue is linked and what is excluded. The Verification section lists setup, steps, before/after screenshots, the browser test coverage, and what was not checked. The description does not link an issue, but the template allows a stated reason for a small obvious fix, and the author gives one.

Finishing Touches

Generate unit tests (beta)

  • 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 dc5ae5c and 3d31e84.

Files selected for processing: 3

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

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

@juliusmarminge juliusmarminge added the takeover:in-progress A takeover lead is working on this PR label Nov 25, 2026
…map-escape-keeps-settings-open

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@juliusmarminge

Copy link
Copy Markdown
Member

Evidence

Chromium, 1280×800, light theme; fresh synthetic data on each commit.

Opened Settings → Connections → Environments, Map view. Selected the environment node and pressed Escape twice. Repeated after selecting This browser and clicking empty space in Details. Base closed Settings on the first Escape in both paths. Head cleared selection on the first Escape and closed Settings on the second.

State Before After
Commit dc5ae5ce63 f5bbfaa198
Environment selected Before: environment selected After: environment selected
First Escape from map button Before: Settings closed After: selection cleared, Settings open
Second Escape from map button Before: Settings closed After: Settings closed
Browser selected, Details focused Before: browser selected After: browser selected
First Escape from Details Before: Settings closed After: selection cleared, Settings open
Second Escape from Details Before: Settings closed After: Settings closed
Recording Before: both focus paths After: both focus paths

Scenario script

The comparison exited 0: fails on base and passes on head.

Not shown:

  • Safari-specific click/focus behavior was not exercised; the runner used Chromium.
  • Choosing a machine or link inside Details was unavailable in the single-environment fixture; the reported equivalent of clicking empty space in Details was exercised.

@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 25, 2026
@juliusmarminge
juliusmarminge merged commit 605980d into pingdotgg:main Nov 25, 2026
57 checks passed
@juliusmarminge juliusmarminge removed the takeover:ready Takeover done; auto-lands when gates pass label Nov 25, 2026
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.

2 participants