Fix Textarea autosize causing scroll anchoring issues in Firefox #18595
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.
Description
This fixes the issue described in #18528 without any side effects. Upon further examination of the issue in Firefox, I noticed the following warning message in the console:
The original solution with setInitialHeight made it so that the check "this.wrapperEl.style.height === newHeight" was only true when the textarea was at its initial height. This causes issues when you have multiple lines and you are typing on one of the existing lines without growing or shrinking the textarea. In that case the "this.wrapperEl.style.height === newHeight" would be false, despite nothing having really changed.
The fix shrinks the textarea itself, determines the scroll height, and then restores the original textarea height. This gives a more accurate check on whether the height really needs to change.
Visual changes
Functional changes
composer cscommand.