fix(windows): keep interactive elements clickable through the titlebar drag region - #229
Open
Pasumao wants to merge 1 commit into
Open
fix(windows): keep interactive elements clickable through the titlebar drag region#229Pasumao wants to merge 1 commit into
Pasumao wants to merge 1 commit into
Conversation
…r drag region The injected full-width drag region sits above every page element at z-index 2147483644, so -webkit-app-region resolves to drag for the whole 36px strip and the global no-drag rule on buttons below it never wins (app-region is resolved by paint order; pointer-events does not opt out). Every interactive control that lives inside the strip - the session header, sidebar collapse, third-party plugin headers - was unclickable on Windows. Fix: punch transparent no-drag patches one layer above the drag region for every interactive element intersecting the strip, tracked with a MutationObserver plus scroll/resize listeners (rAF-throttled). Patches are pointer-events:none so real clicks fall through to the controls; empty strip areas keep dragging the window. Works for any renderer content, including third-party client plugins.
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 (Windows)
Every interactive control that lives inside the 36px Windows titlebar strip is unclickable: the session header buttons, the sidebar collapse button, and the top rows of any third-party client plugin (e.g. a file-explorer column header). Clicks there either do nothing or start a window drag.
Root cause
mountWindowsTitlebarLayout injects a full-width drag region at z-index: 2147483644 with -webkit-app-region: drag. Because it sits on top of all page content, -webkit-app-region resolves to drag for the entire strip: app-region is won by the topmost painted element that declares it, and pointer-events: none does not opt out of that resolution. The global �utton { -webkit-app-region: no-drag !important } escape hatch therefore never applies — those buttons are below the overlay, so the drag region swallows their clicks.
Fix
Punch transparent no-drag holes one layer above the drag region (z-index: 2147483645) for every interactive element (�utton, a, input, select, textarea, [role=button], [data-dsh-no-drag]) whose rect intersects the strip:
esize listeners keep the patches in sync, rAF-throttled;
Verification
Windows 11, DSH Desktop with Harness 0.1.1-rc.2: before the patch, the session header controls, sidebar collapse and third-party plugin headers inside the strip were all dead; after reloading, they are clickable again and the window still drags from empty top areas. Message buttons that scroll under the strip also become clickable while intersecting it.
Tests
Extended est/windows-titlebar.test.ts (same source-assertion style as the existing suite): 8/8 passing, pnpm typecheck clean.