Skip to content

Commit

Permalink
fix: make text area auto-sizing stable (#8207) (#8214)
Browse files Browse the repository at this point in the history
Co-authored-by: Sascha Ißbrücker <sissbruecker@vaadin.com>
  • Loading branch information
vaadin-bot and sissbruecker authored Nov 22, 2024
1 parent eeb2722 commit 3f8e157
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/text-area/src/vaadin-text-area-mixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,13 +155,13 @@ export const TextAreaMixin = (superClass) =>
// position while resetting the textareas height. If the textarea had a large height, then removing its height
// will reset its height to the default of two rows. That might reduce the height of the page, and the
// browser might adjust the scroll position before we can restore the measured height of the textarea.
inputField.style.display = 'block';
inputField.style.height = inputFieldHeight;

// Fix the input element width so its scroll height isn't affected by host's disappearing scrollbars
input.style.maxWidth = inputWidth;

// Clear the height of the textarea to allow measuring a reduced scroll height
input.style.alignSelf = 'flex-start';
input.style.height = 'auto';
}
this._oldValueLength = valueLength;
Expand All @@ -173,7 +173,7 @@ export const TextAreaMixin = (superClass) =>

// Restore
input.style.removeProperty('max-width');
inputField.style.removeProperty('display');
input.style.removeProperty('align-self');
inputField.style.removeProperty('height');
inputField.scrollTop = scrollTop;
}
Expand Down

0 comments on commit 3f8e157

Please sign in to comment.