Problem with scrollIntoView handler

the 1.14.1 version refactor the scrollIntoView function by adding: rect = {left: rect.left - moveX, top: rect.top - moveY, right: rect.right - moveX, bottom: rect.bottom - moveY}

But it causes another probelm.

For example, I am using a Modal to insert something into pm. But the Modal is werid which like its parent node doesn’t contain its Children while the code is like <Parent><Children /></Parent>.

In browser view it looks like: modal

So the position is always wrong when cumulating the pos;

I recommend judging if the parent contains its children in coords before calculate.

That might indeed go wrong for absolute or fixed positioned elements. Can you provide a minimal example of the kind of DOM structure and styling that reproduces the issue, so that I can debug it?

https://jsfiddle.net/qw53jtL8/. There is the minimal expample.(I just don’t how to make it runing on jsfiddle :joy:)

Some dialog component use focus-lock to set focusNode inside dialog.(MDN Article about accessible dialogs

Click the button to insert image and it will make document scroll to bottom when focusNode is button.

Any Suggestion for me?Replace the Dialog Component or scrollIntoView handler will compatible with this situation?

Thanks

This patch should help with this.

It looks like scrollX only exists in window, so when it returns undefined the result is NaN.

Oh, right, I guess that only worked because it broke scrolling entirely. I’ve pushed another patch to correctly use scrollLeft/scrollTop.

Why repleace scrollX with scrollTop? Is that a mistake?

Oh, wow, I really don’t seem to be able to get this right. Pushed another patch.

It works now. Thank you!