Fix popups not closing when clicking the toolbar#20
Merged
Conversation
The toolbar uses `-webkit-app-region: drag` so the window can be dragged by it. The full-viewport popup backdrops defaulted to `app-region: none`, which is transparent to drag hit-testing, so a click landing over the toolbar was consumed by the OS as a window-drag gesture and never dispatched a DOM mousedown to the backdrop -- leaving the popup open. Clicking anywhere else dismissed it as expected. Mark the backdrops `-webkit-app-region: no-drag` so that, while a popup is open, the backdrop claims the toolbar region and clicks there dismiss the popup. The backdrops are unmounted when the popup closes, so the toolbar reverts to draggable immediately. Co-Authored-By: Claude Opus 4.8 (1M context) <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.
Problem
When a repository is open, clicking the toolbar (the bar with the refresh/theme buttons) while the repo-switcher or branches popup is open did not close the popup. Clicking anywhere else in the UI dismissed it correctly, so the inconsistency felt like a UX bug.
Cause
The
.toolbaruses-webkit-app-region: dragso the window can be dragged by it. The full-viewport popup backdrops (.popover-backdrop,.ctx-menu__backdrop) defaulted toapp-region: none, which is transparent to drag hit-testing. So a click landing over the toolbar was consumed by the OS as a window-drag gesture and never dispatched a DOMmousedownto the backdrop — leaving the popup open.Fix
Mark the backdrops
-webkit-app-region: no-drag. While a popup is open, the backdrop claims the toolbar region so clicks there reach the backdrop'sonMouseDownand dismiss the popup.This is safe: the backdrops are unmounted (not just hidden) when the popup closes, so the toolbar reverts to draggable immediately —
app-regionis resolved live per pixel from the topmost element, leaving no stale state.🤖 Generated with Claude Code