Jumpy editor behavior in scrollable container
See original GitHub issueDo you want to request a feature or report a bug?
bug
What’s the current behavior?
Editor jumps up and down when it is placed inside a scrollable container. This issue is different from other issues previously reported because they all target older versions of Slate. GIF: https://share.getcloudapp.com/7KuyN5zo
Slate: 0.57.1 Browser: Chrome OS: Windows
What’s the expected behavior?
Slate should scroll inside its container and not scroll the parent container.
Possible Reason
Slate 0.50+ seems to be using https://github.com/stipsan/scroll-into-view-if-needed in order to bring selected view into focus. Scroll-into-view have a property boundary
which allows us to define a parent element inside which it should position the item… This parameter seems to be missing here https://github.com/ianstormtaylor/slate/blob/e54b07eba8ab23a8c26b275f77e8ec207f8c9b55/packages/slate-react/src/components/editable.tsx#L197 and it causes the parent container to scroll along with editor. This issue can be reproduced on the official site for said library here (https://scroll-into-view-if-needed.netlify.com/) if you disable the boundry check box next to Limit propagation you’ll see it scrolls the whole document when positioning the element.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:8
- Comments:9 (1 by maintainers)
Top GitHub Comments
Anxiously waiting.I’m also experiencing this
Don’t want to pile on this thread but the above commit (1652eca) fixes my experience of this bug locally quite nicely.