Skip to content

Commit 9ab67bf

Browse files
committed
chore: update comments based on the new regression test
1 parent 43a2d0a commit 9ab67bf

1 file changed

Lines changed: 8 additions & 6 deletions

File tree

packages/text-area/src/vaadin-text-area-mixin.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -162,8 +162,11 @@ export const TextAreaMixin = (superClass) =>
162162
const inputFieldScrollTop = inputField.scrollTop;
163163

164164
// Save page scroll around the brief textarea collapse below.
165-
// Pinning the input-field's height would capture the previous cycle's rendered height and feed it
166-
// back into this cycle's scrollHeight measurement, oscillating under fractional rounding.
165+
// Without this, the document briefly shrinks while the textarea is reset
166+
// to natural height for measurement; the browser clamps `scrollY` to the
167+
// new (smaller) max, and after phase 2 grows the textarea back the scroll
168+
// position stays clamped — user-visible scroll jump on backspace at end
169+
// of a large value (vaadin/web-components#291).
167170
const pageScrollX = window.scrollX;
168171
const pageScrollY = window.scrollY;
169172

@@ -178,10 +181,9 @@ export const TextAreaMixin = (superClass) =>
178181
// Restore
179182
inputField.scrollTop = inputFieldScrollTop;
180183

181-
// Restore scroll if the brief collapse caused the browser to adjust
182-
// it. `behavior: 'instant'` bypasses any host-page
183-
// `scroll-behavior: smooth` so the restoration is a synchronous jump,
184-
// not an animation.
184+
// Restore the page scroll position. `behavior: 'instant'` bypasses any
185+
// host-page `scroll-behavior: smooth` so the restoration is a synchronous
186+
// jump, not an animation.
185187
if (window.scrollX !== pageScrollX || window.scrollY !== pageScrollY) {
186188
window.scrollTo({ left: pageScrollX, top: pageScrollY, behavior: 'instant' });
187189
}

0 commit comments

Comments
 (0)