fix(v3/macos): guard InvisibleTitleBarHeight and fix top-corner resize shaking (#4962)

* fix(v3/macos): guard InvisibleTitleBarHeight and fix top-corner resize shaking (#4960)

- Only apply InvisibleTitleBarHeight when the native drag area is actually
  hidden (frameless window or transparent title bar presets like HiddenInset).
  Previously it was applied unconditionally, which could swallow clicks near
  the top of standard windows.

- Skip drag initiation when the click is near the left/right window edges
  within the invisible title bar zone. This prevents conflict between
  dragging and native top-corner resizing, which caused window content to
  shake/jitter.

Fixes #4960

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* docs: update InvisibleTitleBarHeight docs and changelog (#4960)

Document that InvisibleTitleBarHeight only applies to frameless or
transparent title bar windows, and add changelog entries for the
guard and edge-detection fixes.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Lea Anthony 2026-02-09 07:35:35 +11:00 committed by GitHub
commit e999741e9b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 19 additions and 3 deletions

View file

@ -394,7 +394,7 @@ body {
```
**Invisible title bar:**
Allows dragging whilst hiding the title bar:
Allows dragging whilst hiding the title bar. This only takes effect when the window is frameless or uses `AppearsTransparent`:
```go
Mac: application.MacOptions{
InvisibleTitleBarHeight: 40,

View file

@ -792,7 +792,8 @@ Mac: application.MacWindow{
**InvisibleTitleBarHeight** (`int`)
- Height of invisible title bar area (for dragging)
- Useful when title bar is hidden
- Only takes effect when the native title bar drag area is hidden — i.e. when the window is frameless (`Frameless: true`) or uses a transparent title bar (`AppearsTransparent: true`)
- Has no effect on standard windows with a visible title bar
**WindowLevel** (`MacWindowLevel`)
- `MacWindowLevelNormal` - Standard window level (default)

View file

@ -25,6 +25,9 @@ After processing, the content will be moved to the main changelog and this file
## Fixed
<!-- Bug fixes -->
- Fix `InvisibleTitleBarHeight` being applied to all macOS windows instead of only frameless or transparent title bar windows (#4960)
- Fix window shaking/jitter when resizing from top corners with `InvisibleTitleBarHeight` enabled, by skipping drag initiation near window edges (#4960)
- Fix generation of mapped types with enum keys in JS/TS bindings (#4437) by @fbbdev
## Deprecated
<!-- Soon-to-be removed features -->

View file

@ -1334,7 +1334,10 @@ func (w *macosWebviewWindow) run() {
C.windowSetAppearanceTypeByName(w.nsWindow, C.CString(string(macOptions.Appearance)))
}
if macOptions.InvisibleTitleBarHeight != 0 {
// Only apply invisible title bar when the native drag area is hidden
// (frameless window or transparent/hidden title bar presets like HiddenInset)
if macOptions.InvisibleTitleBarHeight != 0 &&
(w.parent.options.Frameless || titleBarOptions.AppearsTransparent) {
C.windowSetInvisibleTitleBar(w.nsWindow, C.uint(macOptions.InvisibleTitleBarHeight))
}

View file

@ -345,6 +345,15 @@ typedef NS_ENUM(NSInteger, MacLiquidGlassStyle) {
NSPoint location = [event locationInWindow];
NSRect frame = [window frame];
if( location.y > frame.size.height - self.invisibleTitleBarHeight ) {
// Skip drag if the click is near a window edge (resize zone).
// This prevents conflict between dragging and native top-corner resizing,
// which causes window content to shake/jitter (#4960).
CGFloat resizeThreshold = 5.0;
BOOL nearLeftEdge = location.x < resizeThreshold;
BOOL nearRightEdge = location.x > frame.size.width - resizeThreshold;
if( nearLeftEdge || nearRightEdge ) {
return;
}
[window performWindowDragWithEvent:event];
return;
}