-
Notifications
You must be signed in to change notification settings - Fork 3.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The body jump scroll position if you click between multiple quill editors #855
Comments
This update fixes it |
Im curious why even have this code? What's the purpose of it? Why should the editor ever control the scroll position of the body? let scrollTop;
this.root.addEventListener('blur', () => {
scrollTop = this.root.scrollTop;
});
this.root.addEventListener('focus', () => {
if (scrollTop == null) return;
this.root.scrollTop = scrollTop;
}); |
Are you sure you included the right code snippet? This is not what the 1.0.0-beta.11 selection.js file looks like. |
@jhchen hmm yah I got it from a commit 22 days ago. But with the newest quill beta 11 var scrollTop = void 0,
bodyTop = void 0;
this.root.addEventListener('blur', function () {
scrollTop = _this.root.scrollTop;
bodyTop = document.body.scrollTop;
});
this.root.addEventListener('focus', function (event) {
if (scrollTop == null) return;
_this.root.scrollTop = scrollTop;
document.body.scrollTop = bodyTop;
}); This code make the page jump when blur and focus are triggered between editors. I am using multiple quill editors on the same page. So I just commented that snippet of code out. What is it for? There seems to be no issues with the editor. The way I use the quill editor, it is inline, so the editor itself never has a scrollbar, only the body of the page. The editor div can grow and shrink based on the content. |
The reason is some browsers will incorrectly scroll the editor to the top on blur/focus. This might happen when clicking on the toolbar, interacting with link tooltip, on paste, and maybe some other interactions I'm forgetting. So this code snippet is meant to saves and restores the scroll position. |
hmm but for me on chrome it just makes the editor jump around on focus and blur. So I removed that snippet, and everything seems to be ok. |
I can confirm this behavior on Chrome as well with multiple editors present using v1.0.0-rc.0 |
If you have multiple quill editors on the same page, when you click from one editor to the other it makes the body jump scroll position. It does not always do this, but 50% of the clicks from one editor to another makes the body scroll.
Steps for Reproduction
I will update with reproduction of the issue
Expected behavior: The body should not scroll by simple clicking in the editor. Why does the editor even affect the body scroll position? Is this some feature? Can I turn it off?
Platforms: Chrome on Mac
The text was updated successfully, but these errors were encountered: