CR: Specifying a top-most node to be scrolled for `scrollIntoView` method


#1

Method scrollIntoView is changing the scroll position of every possible node in the document’s DOM to get the text visible: is it possible to limit the changes at most for the main editor node (or to specify the node where the changes should stop)?

My use case: I might have an editor outside of the view in the panel placed in container to be scrolled to by the user—I’d like to position the scroll inside the editor but not in my panel/container.


#2

This isn’t currently possible, and is also not how scrolling a cursor into view tends to behave — when the user is editing, they tend to want to see their cursor, even if that means scrolling stuff.


#3

I’m not really interested in changing the behaviour when is user is editing—this is completely fine with me.

I’m rather thinking only of switching the focus among my panels/containers. When the user activate given panel/container then it might get also a stored selection to be placed into the editor (through the API): if I have multiple such panels (some of them outside of the viewport as described above) I get a lot of jerkiness because of the container scrolling.

I hope that those arguments are more convincing but I’ll understand that your answer is final and I should understand it as “won’t do”. :slight_smile:


#4

I’d say you don’t want the transaction scrollIntoView method there anyway, and it might make sense to just write your own scrolling code on top of coordsAtPos.


#5

That’s an idea!

Thanks for your assistance, Marijn!

P.S. I’d like to point your attention to another, somewhat related CR; thanks in advance for your time!