fix(chat-sidebar): close workspace file picker on Escape from search input#266
Merged
Merged
Conversation
…input The wrapper popover already had an Escape handler, but the search input inside it called event.stopPropagation() unconditionally so the chat sidebar's keyboard shortcuts wouldn't fire while the user typed a filter. Escape was getting eaten as collateral, so the dialog could only be closed by clicking the X. Let Escape bubble while still stopping every other key. The wrapper's existing handler does the rest. No new tests: the existing test surface doesn't mount SidebarComponent, and the keydown delegation is trivial to inspect by hand. Verified the same pattern in claude-session-picker and notebook-generation-popover during review; neither has the bug because their popovers don't contain keystroke-suppressing inputs. Fixes plmbr#262
mbektas
approved these changes
May 16, 2026
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
The "Add files as context" dialog (opened from the
@button in the chat sidebar) ignored the Escape key once the user clicked into the search field. The wrapper popover already handled Escape, but the search input's keydown listener calledstopPropagation()for every key to keep the chat sidebar's keyboard shortcuts from firing while typing a filter. Escape was getting eaten as collateral, so the only way to dismiss the dialog was clicking the close icon.Solution
In
src/chat-sidebar.tsx, gate the input'sstopPropagation()onevent.key !== 'Escape'. Escape bubbles to the popover's existing handler at line 3907; everything else is still swallowed so the sidebar shortcuts don't fire during a search.Testing
jlpm tsc --noEmit && jlpm lint:check && jlpm jestgreen. Manual: opened the picker, focused the search field, pressed Escape, dialog closes.No new automated test.
SidebarComponentisn't mounted by any existing jest test (it pulls in JupyterLab services,NBIAPI, and the workspace file fetch); standing up a harness for a 7-line keydown-delegation fix would be a multi-hour scaffold. A Playwright e2e would be the right home if regression coverage becomes interesting later.Risks / follow-ups
Audited the two sibling popovers (
src/components/claude-session-picker.tsxandsrc/components/notebook-generation-popover.tsx) for the same pattern. Neither has the bug: the session picker has no input to swallow keys, and the notebook-generation popover's textarea handler only intercepts Enter.Fixes #262