Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove auto height setting #268

Merged
merged 2 commits into from
Oct 10, 2024
Merged

remove auto height setting #268

merged 2 commits into from
Oct 10, 2024

Conversation

sarah-storm
Copy link
Contributor

Closes #240

I was able to replicate this one in the examples, and the culprit seems to be setting the height of the text area to auto - causing the browser to jump.

I gave this a shot without setting the height to auto first, and it seemed to still work fine. I checked in Chrome, FF, Edge and safari iOS.

I can see that setting the height to auto first is recommended in the blog posts I've found about auto-resizing text areas. However those all seem to be a good few years old now, so perhaps more modern browsers no longer have that requirement in order to grab an accurate scroll height?

The original fix in the ticket also works though, so if it's better to go with that then I can update!

@sarah-storm sarah-storm requested a review from mjbp October 9, 2024 12:54
Copy link
Contributor

@mjbp mjbp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this only supports resizing up. If you delete content from the textarea the scrollHeight remains the same height testing on Edge.

@sarah-storm
Copy link
Contributor Author

Aah of course that's what it's there to do. Cool - have updated to the fix in the original issue ticket which works perfectly well in both directions!

@mjbp mjbp merged commit e0e494d into master Oct 10, 2024
1 check passed
@mjbp mjbp deleted the bug/240-textarea-scroll-change branch October 10, 2024 13:47
@mjbp
Copy link
Contributor

mjbp commented Oct 10, 2024

Great, thanks! I'll release shortly.

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.

Textarea > scroll change
2 participants