Repository navigation
fix(desktop): close a takeover on Escape after focus falls to the body - #922
Merged
Merged
Conversation
A focused Refresh button that goes disabled while its read runs drops focus to <body>, outside each surface's @onkeydown, so Escape left the Sessions and Pull requests takeovers open. A document listener in app.js now hears Escape on <body> while a surface marked data-escape-closes is open, unless a modal is open or the key was already handled, and calls back into Home. Fixed once in the shell for Tools, Dashboard, Sessions and Pull requests; the Roadmap keeps its deliberate no-Escape rule. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Escape now closes a takeover surface even after focus has fallen to
<body>. QA found that clicking Refresh on Pull requests (and Sessions) disables the focused button while the read runs, the browser drops focus to<body>, and the next Escape never reached the surface's@onkeydown— the takeover stayed open. Fixed once in the shell rather than per pane.Changes
wwwroot/app.js:backlogTakeoverEscape, a documentkeydownlistener that acts on Escape only when<body>/<html>(a key pressed inside a surface or the header stays with its own handler),main[data-escape-closes]is on screen,defaultPreventedand no[aria-modal="true"]/dialog[open]is open (dialogs and menus keep Escape).It then calls
Home.CloseSurfaceOnEscapeAsync.Shell/Home.razor: Tools, Dashboard, Sessions and Pull requests<main>s carrydata-escape-closes; Home registers with the listener on first render and unregisters on dispose; the new[JSInvokable]re-checks a closing surface is still open before closing.Testing
HomeWorkspaceSurfaceTests: the callback closes each of the four surfaces (which carry the marker), leaves the Roadmap open (no marker), and the shell registers/unregisters the listener.dotnet build Backlog.sln: 0 warnings, 0 errors. All 28 test executables: 0 failed.activeElementwas<body>(button "Reading…"), Escape closed the surface; Tools closed with focus on body; Roadmap stayed open. No harness error logs.Related
No issue — found by QA on the Pull requests surface.
Checklist
🤖 Generated with Claude Code