mirror of
https://github.com/open-webui/open-webui.git
synced 2026-09-20 00:11:27 +00:00
fix: preserve scroll position in Textarea resize to prevent page jump on focus
This commit is contained in:
parent
8dae237a0b
commit
9359dd0fd6
1 changed files with 6 additions and 0 deletions
|
|
@ -35,6 +35,9 @@
|
|||
|
||||
const resize = () => {
|
||||
if (textareaElement) {
|
||||
// Preserve scroll position to prevent page jumping to top on focus/resize
|
||||
const scrollY = window.scrollY;
|
||||
|
||||
textareaElement.style.height = '';
|
||||
|
||||
let height = textareaElement.scrollHeight;
|
||||
|
|
@ -46,6 +49,9 @@
|
|||
}
|
||||
|
||||
textareaElement.style.height = `${height}px`;
|
||||
|
||||
// Restore scroll position after height recalculation
|
||||
window.scrollTo({ top: scrollY, behavior: 'instant' });
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue