Skip to content

Conversation

@Saracaen
Copy link
Contributor

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:

Scroll anchoring was disabled in a scroll container because of too many consecutive adjustments (10) with too little total distance (0 px average, 0 px total).

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

  • Code style has been fixed by running the composer cs command.
  • Changes have been tested to not break existing functionality.
  • Documentation is up-to-date.

@Saracaen
Copy link
Contributor Author

I have no idea why this one test appears to fail, but it seems unrelated to my changes.

@Saracaen
Copy link
Contributor Author

Looks like a spurious error, considering that it passed upon retriggering the actions.

@Saracaen Saracaen changed the title Fixed scroll anchoring on Firefox Fix Textarea autosize causing scroll anchoring issues in Firefox Nov 25, 2025
@danharrin danharrin added bug Something isn't working pending review labels Nov 25, 2025
@danharrin danharrin added this to the v4 milestone Nov 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working pending review

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

2 participants