react-markdown-editor-lite icon indicating copy to clipboard operation
react-markdown-editor-lite copied to clipboard

[BUG] In md-only mode, changes to text cause browser to scroll-to-top

Open lefnire opened this issue 5 years ago • 1 comments

OS and browser

Windows 10, Chrome 84.0; Android Chrome

Description

If your editor contents (in md-mode) are long enough for a scroll-bar / overflow-y, then updating the content immediately scrolls you to top of page. It doesn't do it in md+html mode. I've tried setting config: {syncScrollMode: []}. I've also tried removing value={text} onChange={onChange} in case it's React parent component updates causing the scroll.

I see scroll sync events are emitted regardless, maybe there's a way to catch that & cancel? Or just not perform any scrolling when in md-mode?

Reproduction URL

https://codesandbox.io/s/festive-dream-89opu?file=/src/App.js

lefnire avatar Aug 29 '20 22:08 lefnire

Actually, looks like it's just autoResizeMode in md-mode. If I remove that plugin & set the height manually it works: https://codesandbox.io/s/frosty-lake-gi1n0?file=/src/App.js

lefnire avatar Aug 29 '20 22:08 lefnire