Textarea does not scroll when needed
LeaVerou opened this issue · comments
Lea Verou commented
When replaying edits, the textarea doesn't scroll so that the part edited is always visible.
There are two ways to address this:
- In
Replayer
, scroll to part currently being edited. No way to do this in the web platform. For textareas that don't wrap we can approximate by number of line breaks before caret, but it's hacky and unreliable. - Record scrolling as an action. Since sometimes the speaker scrolls to show something, this would allow rety to more closely replicate these types of demos. But what to record? We don't want to just record a px offset, since the actions may be replayed on a completely diifferent textarea with different styling. For the same reason, recording percentage offset also wouldn't be helpful. Maybe something related to font size? I.e. scroll offset divided by line height (for vertical scroll) or em width (for horizontal scroll). Also, which scrolls to record? If we record every time the
scroll
event fires, that would be very noisy.