Andarist / Andarist/react-textarea-autosize

Scroll when new row is inserted beyond maxRows

Offen
#142 0 Kommentare 3 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
enhancement
Vorherrschende Sprache
TypeScript
Sterne
2.4k
Forks
247
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

Problem is that often built-in scroll while typing, creating new row and focusing is not enough - aesthetically wise.

I would propose introducing additional auto scroll behaviour when new row is created, either to the bottom of the textarea or to something similar to this formula:
```javascript
var { lineHeight, fontSize } = window.getComputedStyle(textareaRef)
textareaRef.scrollTop = textareaRef.scrollTop + (parseInt(lineHeight, 10) - parseInt(fontSize, 10))/2
```
Personally I think that scrolling to the bottom would be a better choice though.

Im happy to create a PR for this, but need to know first if you are interested in such a feature.

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.