Fix: enforce viewport boundaries during window resize - #401
Merged
AllTerrainDeveloper merged 3 commits intoJul 23, 2026
Conversation
CookieDarb
marked this pull request as ready for review
July 23, 2026 15:11
Collaborator
|
Ouch, I haven't seen this PR and already merged a similar one, but Ill also merge this one as it adds value with the tests. Thank you! |
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
Collaborator
|
Sorry for jumping in and pushing to your branch directly — I took the opportunity to combine the two fixes. Since #402 was already merged, I brought trunk in and kept your Thank you for the great fix and especially for the tests — much appreciated! 🙏 |
AllTerrainDeveloper
approved these changes
Jul 23, 2026
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.
What?
Closes #399
Enforces viewport boundaries during window resize to prevent the title bar from going off-screen.
Why?
Previously, dragging the top handles past the physical edges of the desktop allowed the math to compute negative coordinates for the window. This pushed the window's title bar off-screen, rendering the window permanently unreachable and unmovable without refreshing the page.
How?
src/window/pointer.ts:computeResizeto ensurexandynever fall belowEDGE_MARGIN(0).widthandheightby the clamped difference so the opposite pinned edges remain perfectly locked in place despite the clamp.tests/vitest/window-resize.test.ts:Testing Instructions
y=0) and remains fully reachable.Screencast
Screen.Recording.2026-07-23.at.8.31.13.PM.mov