Skip to content
This repository has been archived by the owner on Jun 30, 2024. It is now read-only.

Fix: textarea larger than window being jumpy at the bottom #85

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions source/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,15 @@ export const resize: Resize = (rows, el) => {
el.style.height = '0'
el.style.overflowY = overflowY
el.style.height = `${getHeight(rows, el)}px`

if (document.activeElement === el) {
if (
el.getBoundingClientRect().bottom > window.innerHeight &&
el.selectionStart === el.value.length
) {
window.scrollTo(el.scrollLeft, el.scrollTop + el.scrollHeight)
}
}
}
}

Expand Down