1
1
mirror of https://github.com/NoRedInk/noredink-ui.git synced 2024-12-30 17:14:43 +03:00
noredink-ui/lib
Michael Hadley b907c12d7a Prevent text area with auto resize from jumping scroll position
The old logic looked like this:

```
if (this._textarea.scrollHeight > minHeight) {
  this._textarea.style.height = minHeight + 'px'
  this._textarea.style.height = this._textarea.scrollHeight + 'px'
}
```

Imagine a case where the `minHeight` is actually less than the current
height of the text area due to the current content. The height of the
element would be set to a smaller value, and then later reset to the
desired height. This causes the overall scroll height of the page to
shrink (because the text-area did), and then expand again. Now the
scroll position for the user on the page has changed, and this happens
on every keystroke.

This change just skips the first assignment to `.height`. I'm not sure why it
was initially there, but I can't see a reason for keeping it (especially
since it seems to be the cause of this bug).
2020-03-27 11:34:00 -07:00
..
TextArea Prevent text area with auto resize from jumping scroll position 2020-03-27 11:34:00 -07:00
CustomElement.js Revert "Merge pull request from NoRedInk/puffins/prepare-for-merge" 2020-03-06 20:00:34 +01:00
index.js Revert "Merge pull request from NoRedInk/puffins/prepare-for-merge" 2020-03-06 20:00:34 +01:00