`focus()` cause unexpected scroll
See original GitHub issueDo you want to request a feature or report a bug? bug
What is the current behavior?
On chrome 61.0.3163.79, the view will scroll to top if the editor’s focus()
method were called.
If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem. Checkout this: https://jsfiddle.net/85t88Lat/
What is the expected behavior? Just get the editor focused, without the extra scroll.
Which versions of Draft.js, and which browser / OS are affected by this issue? Did this work in previous versions of Draft.js? Draftjs/0.10.1 Chrome/61.0.3163.79
Issue Analytics
- State:
- Created 6 years ago
- Reactions:8
- Comments:12 (1 by maintainers)
Top Results From Across the Web
1069739 - DIVs with overflow receiving focus, causing issues ...
This behavior may be beneficial, when the scrollable element contains no focusable children. If the scrollable element would not be able to receive...
Read more >Focus div without jumping to it - Stack Overflow
JQuery's .focus() works, but automatically scrolls the element into view. This is a problem on limited viewports, where the top of the page ......
Read more >How to fight the <body> scroll. First of all - Medium
Move the focus, or press keys. Not be able to press. Scroll it. Not be able to scroll. Ok then — WHEN it...
Read more >Focus restore on dialog close can cause unwanted scrolling
If the originally-focused element is not in view at the time of closing the dialog, this call to .focus() will result in it...
Read more >Focus management and inert | CSS-Tricks
it is clicked on, following an anchor that links to another focusable element,; or focus is programmatically set through element.focus() in ...
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 FreeTop 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
Top GitHub Comments
Thanks everyone for flagging this and confirming the fix! I also was able to reproduce it in Chrome Canary (Chrome v63).
It looks like we have updated
fbjs
internally at FB but not yet in thepackage.json
for Draft in open source. Just opened a PR to update this for everyone in open source, and will do a minor release to get that out to folks asap. 🐎I experiencing this scroll behaviour with other things (jQuery.focus() for example). As I am not able to find out, what causes this, I am interested in what the fix is in the fbjs lib to prevent this scroll. Possibly I could apply this fix for my problem.