Skip to content

fix: Improve viewport resizing behavior (backport of #2170)#2239

Merged
thevaadinman merged 2 commits into
5.4from
fix-viewport-resizing-5.4
May 8, 2026
Merged

fix: Improve viewport resizing behavior (backport of #2170)#2239
thevaadinman merged 2 commits into
5.4from
fix-viewport-resizing-5.4

Conversation

@thevaadinman
Copy link
Copy Markdown
Contributor

Original description:

The fix replaces the single-shot adjustment with a converging retry loop. The browser chrome (title bar, borders) is constant for a session. Iteration 1 discovers the offset, iteration 2 (or rarely 3) nails the target. 5 attempts is generous safety margin for unusual environments (remote grids, DPI scaling).

Removes hardcoded Mac FF offsets that are irrelevant for modern browsers and cause unnecessary overshoot on other platforms (extrah=106, extraw=0) — starts with the desired dimensions directly

Loops up to 5 times, each iteration measuring the actual viewport via JS, computing the diff, and adjusting the window size using the current window size (not accumulated offsets)

Returns early as soon as the viewport matches the target

Re-throws UnsupportedOperationException without wrapping, while wrapping other exceptions

Logs each adjustment at debug level for troubleshooting

Fixes: [https://github.com//issues/2167]

thevaadinman and others added 2 commits May 8, 2026 14:17
Original description:

The fix replaces the single-shot adjustment with a converging retry loop. The browser chrome (title bar, borders) is constant for a session. Iteration 1 discovers the offset, iteration 2 (or rarely 3) nails the target. 5 attempts is generous safety margin for unusual environments (remote grids, DPI scaling).

Removes hardcoded Mac FF offsets that are irrelevant for modern browsers and cause unnecessary overshoot on other platforms (extrah=106, extraw=0) — starts with the desired dimensions directly

Loops up to 5 times, each iteration measuring the actual viewport via JS, computing the diff, and adjusting the window size using the current window size (not accumulated offsets)

Returns early as soon as the viewport matches the target

Re-throws UnsupportedOperationException without wrapping, while wrapping other exceptions

Logs each adjustment at debug level for troubleshooting

Fixes: [#2167]
@thevaadinman thevaadinman requested a review from Ansku May 8, 2026 11:22
@thevaadinman thevaadinman merged commit 7ec2b25 into 5.4 May 8, 2026
4 checks passed
@thevaadinman thevaadinman deleted the fix-viewport-resizing-5.4 branch May 8, 2026 11:25
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.

2 participants