Skip to content

Fix popups not closing when clicking the toolbar#20

Merged
danipen merged 1 commit into
mainfrom
fix-popup-dismiss-on-toolbar
Jun 4, 2026
Merged

Fix popups not closing when clicking the toolbar#20
danipen merged 1 commit into
mainfrom
fix-popup-dismiss-on-toolbar

Conversation

@danipen

@danipen danipen commented Jun 4, 2026

Copy link
Copy Markdown
Owner

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 .toolbar uses -webkit-app-region: drag so the window can be dragged by it. The full-viewport popup backdrops (.popover-backdrop, .ctx-menu__backdrop) 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.

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's onMouseDown and 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-region is resolved live per pixel from the topmost element, leaving no stale state.

🤖 Generated with Claude Code

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>
@danipen danipen merged commit a7b799d into main Jun 4, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant