Body jumping to the top when you refocus (after losing focus)
See original GitHub issueSteps for Reproduction
- Visit lesson 10 of cloning medium guide.
- Press enter a bunch of time and then scroll down so that top of the screen is out of the viewport. (Basically, till you can’t see “tell your story…”)
- Click anywhere outside the editor area so that editor loses focus.
- Now click on the sidebar button directly and you can see the document jumping at the top even though it sets the cursor at the correct position.
Expected behavior: Expect body ( scroll container ) to not jump at the top and set the cursor at the position it was before.
Actual behavior: Body( scroll container ) jumps at the top but sets the cursor position at the correct range.
Platforms: Browser: Chrome, Version 66.0.3359.139 (Official Build) (64-bit) OS: MacOS El Capitan, 10.11.6
Version:
Quill version: 1.3.6
I think i have narrowed down the issue to this part of the code
restoreFocus() {
let scrollTop = this.quill.scrollingContainer.scrollTop;
this.quill.focus();
this.quill.scrollingContainer.scrollTop = scrollTop;
}
This behaviour is also reproducible when you use setSelection(index) method.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:11
- Comments:5
Top Results From Across the Web
Why You Can't Focus And How to Stop Losing Focus - Lifehack
Being overburdened can increase stress and anxiety which we already identified as causes for lack of focus.
Read more >3 Ways to Refocus Your Attention on Fitness
Losing motivation and focus definitely happens. And most of the time, it's truly not the end of the world. But if you're ready...
Read more >React.js - input losing focus when rerendering - Stack Overflow
The reason input was losing focus in my case was due to the fact that I was re-rendering the input on state change....
Read more >Need Help Staying Focused? Try These 10 Tips - Healthline
Learn proven ways to improve your focus and concentration at work, school, ... You may also find that the following behavioral practices may...
Read more >7 Steps to Regaining Your Focus - Entrepreneur
1) Remind yourself why you're in business. · 2) List your top priorities. · 3) Synchronize your breath and body. · 4) Drink...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
This happened to me too when I insert a link into toolbar and press Enter. After debugging I think it’s caused by this line
Here is my temporary solution that helps scrolling into the previous selection.
See more scroll options.
Theme: Bubble
Browsers: Chrome/76.0.3809.132 Safari/537.36
Notes: this.mQuillEditor = new Quill(ref, options); this.mBodyTop is just a storing variable.
I find the solution here: https://github.com/quilljs/quill/issues/855 But I change it up a little so it actually works. At least, it works for me.
Versions: Quill ^1.3.7 Theme snow Chrome Version 90.0.4430.212