-
-
Notifications
You must be signed in to change notification settings - Fork 824
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
Auto resizing sl-textarea makes page scroll to top when typing #2180
Comments
One workaround that works to prevent this behavior, is setting a height to the const onInput = () => {
this.textArea.style.height = `${this.textArea.shadowRoot?.querySelector('[part="form-control"]')?.scrollHeight}px`;
} I assume that this could be a similar issue vuetify used to have? vuetifyjs/vuetify#5314 |
Thanks for the report and the suggested workarounds. I ended up finding something that worked across all 3 browsers pretty cleanly. And here's the "fixed" jsfiddle: https://jsfiddle.net/n158gvy7/3/ If you don't mind giving it a quick test, that would help me a ton! |
Thank you for the quick fix! It works fine on my side too. Also tested it on all 3 browsers and nothing is shaking or irritating. |
I just updated the shoelace version in my project with this fix and noticed something strange on mobile firefox. At some point the height starts flickering within 1px (in my case between I tested it on firefox and chrome on my android phone and it only happens on firefox (couldn't test Safari, because I don't have an iOS device). Not sure if using Firefox version: 132.0 Notice the flickering of the markdown toolbar. screen.recorder.phone.mp4Here you can see the mentioned behaviour between each keystroke on phone (the counter in the help text attribute is the character counter, you can use this to understand when i typed a new letter). This is a recording of the inspector, using external debugging on my phone's firefox browser. flickering.heights.mp4@KonnorRogers Could you please check if you get the same behaviour? Perhaps it is only a phenomena I am experiencing. |
Describe the bug
When the textarea, with the
resize="auto"
property set, becomes larger than it fits on the screen, it scrolls the page back to top on every additional new line.To Reproduce
Steps to reproduce the behavior:
Demo
https://jsfiddle.net/Dukiii/m4cvhLrw/1/
Screenshots
screencast.2024-09-23.12-22-42.mp4
Browser / OS
The text was updated successfully, but these errors were encountered: