Fix window title bar pushed off-screen during top-edge resize (#399) - #402
Merged
AllTerrainDeveloper merged 3 commits intoJul 23, 2026
Merged
Conversation
…ess#399) When resizing a window using the upper handles (nw or ne), the window could be extended beyond the upper boundary of the desktop viewport, pushing the title bar off-screen and leaving the window stuck in an inaccessible state. This fix adds bounds checking to the onResizeMove handler that mirrors the existing drag handler pattern. The window position is now constrained to the desktop bounds, preventing: - Top-edge resizing (nw, ne) from pushing y below EDGE_MARGIN - Left-edge resizing (nw, sw) from pushing x below EDGE_MARGIN - Right/bottom edges from extending beyond desktop bounds The computeResize() function remains pure math with no bounds awareness, keeping the separation of concerns clean. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Collaborator
|
Hey! Thank you very much, this has fixed that particular issue, the PR is still valid, but I'll create a new issue with the following behaviour that needs to be fixed too: bounds.mov |
AllTerrainDeveloper
approved these changes
Jul 23, 2026
AllTerrainDeveloper
left a comment
Collaborator
There was a problem hiding this comment.
Awesome! Thank you!
Collaborator
|
@alshakerM and welcome!
|
AllTerrainDeveloper
added a commit
to CookieDarb/desktop-mode
that referenced
this pull request
Jul 23, 2026
Trunk picked up two fixes for the same bug (WordPress#399): WordPress#402 clamped the window position in onResizeMove after the math ran, and this PR clamps inside computeResize while shrinking the dimension by the clamped difference. The handler-side clamp is strictly worse once both exist: clamping y without compensating height lets the pinned bottom edge slide down while the user drags the top handle, and its Math.min against the desktop's right/bottom shifts the whole window during a plain SE grow — stricter than what drag itself enforces. Keep the pure-math clamp (which the vitest suite covers directly) and remove the handler block. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WCknM6zk6JS14pdLUiqdRR
AllTerrainDeveloper
added a commit
that referenced
this pull request
Jul 23, 2026
* fix: enforce viewport boundaries during window resize * Drop the handler-side resize clamp in favor of the computeResize one Trunk picked up two fixes for the same bug (#399): #402 clamped the window position in onResizeMove after the math ran, and this PR clamps inside computeResize while shrinking the dimension by the clamped difference. The handler-side clamp is strictly worse once both exist: clamping y without compensating height lets the pinned bottom edge slide down while the user drags the top handle, and its Math.min against the desktop's right/bottom shifts the whole window during a plain SE grow — stricter than what drag itself enforces. Keep the pure-math clamp (which the vitest suite covers directly) and remove the handler block. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WCknM6zk6JS14pdLUiqdRR --------- Co-authored-by: prismiwi2015 <daniel.lopez@automattic.com> Co-authored-by: Claude Fable 5 <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.

Issue: 399
Hi @CookieDarb I was using the desktop mode and ran into this issue, funny enough you already created the issue, it's only fair I fix it 😄
When resizing a window using the upper handles (nw or ne), the window could be extended beyond the upper boundary of the desktop viewport, pushing the title bar off-screen and leaving the window stuck in an inaccessible state.
Before
Screen.Recording.2026-07-23.at.8.25.13.PM.mov
After
Screen.Recording.2026-07-23.at.20.03.40.mov
This fix adds bounds checking to the onResizeMove handler that mirrors the existing drag handler pattern. The window position is now constrained to the desktop bounds, preventing:
The computeResize() function remains pure math with no bounds awareness, keeping the separation of concerns clean.