Repository navigation
Escape closes the right side panel #39983
Closed
nibarAhmed
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Note
🤖 Gemini 4 Neon responding on behalf of nibarAhmed
Opening an issue on
/issues, a pull request on/pull-requests, or any tab (such as a pull request, diff, or file) in the right side panel in Chat shows it beside the main view, but Escape doesn't close that panel in inline mode. On Issues it does nothing, on Pull requests it leaves the page while the panel stays open, and in Chat only narrow viewports (where it renders as aRightPanelSheet) close on Escape. Otherwise the only ways to close it are the tab × buttons andrightPanel.toggle(mod+alt+b).Escape already closes menus, dialogs, find bars and inline editors across the app, so I keep reaching for it here too.
Proposal: Escape hides the right panel—the same as
rightPanel.toggle, with no extra setting toggle needed. Every tab stays, sorightPanel.togglebrings them all back. An issue and its linked pull request open as two tabs of the same panel, so one press hides both. Closing a single tab stays a separate action.PreviewPanelShellalready restores focus to the opener (or[data-right-panel-toggle]) when the panel closes./issuesand/pull-requests: Escape hides the panel from anywhere on the page once inner layers are cleared.[data-workspace-area="panel"]), excluding terminal (terminalFocus), embedded browser guest (previewFocus), and side-chat panes (isInSideChatPane). Opening tabs keeps today's focus behavior—Escape in the main chat composer, conversation, or sidebar never accidentally collapses a workspace panel, and terminals, browser pages, and side chats keep Escape to themselves. (When DOM focus is still outside the panel—including in screen-reader browse mode—F6moves into it andrightPanel.togglecloses it from anywhere.)Each press handles one layer:
[data-workspace-area="panel"]when the field is inside the panel so the next Escape can hide it./issuesand/pull-requests, active sidebar thread multi-selection clears./pull-requestsonly, once the panel is already hidden, Escape leaves the page as it does today.Implementation plan:
IssuesPage.tsx,PullRequestsPage.tsx, and Chat's right-panel actions (useRightPanelActions.ts) throughregisterCommands(onKeyDownonwindow, bubble phase)—not inIssuesPage/PullRequestsPage's existingdocument.addEventListener("keydown", ...)blocks, which attach on mount and would otherwise fire before Base UI'sdocument-level popup Escape handlers.registerCommandsrunsglobalScopesbeforeobserverScopes, consuming Escape inPullRequestsPageautomatically preventsregisterPullRequestsEscapeCommandfrom leaving the page without couplingAppSidebarLayout.repeat, IME composition (isComposing || keyCode === 229), modified chords (metaKey || ctrlKey || altKey || shiftKey), andisCommandPaletteOpen()./issuesand/pull-requests: yield when sidebar threads are multi-selected (page scopes mount inside/_chatand run ahead ofchatRouteCommands.tsin LIFO order).RightPanelSheetis active), whenevent.targetis inside[data-workspace-area="panel"], and when!terminalFocus && !previewFocus && !isInSideChatPane(event.target).document.body:IssueDetailPanel.tsx: addpreventDefault()and theisComposing || keyCode === 229guard to the issue title editor.PullRequestMarkdownEditor.tsx: still callpreventDefault()on Escape whilesavingis true so pressing Escape mid-save doesn't close the panel.IssueCommentComposer.tsx,PullRequestListFilters.tsx,FileBrowserPanel.tsx, andPreviewChromeRow.tsx: handle Escape withpreventDefault()(and IME guard) so typing in the always-mounted issue comment box or search/URL inputs doesn't close the panel and drop drafts; when the field is inside[data-workspace-area="panel"], move focus to the panel host instead of raw.blur()todocument.body, so a follow-up Escape (including after exiting NVDA Focus Mode) still closes the panel.selectionActions.ts: callpreventDefault()when dismissing an active selection toolbar on Escape.Happy to open a PR if a maintainer wants one.
All reactions