question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`focus()` cause unexpected scroll

See original GitHub issue

Do 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:closed
  • Created 6 years ago
  • Reactions:8
  • Comments:12 (1 by maintainers)

github_iconTop GitHub Comments

4reactions
flarniecommented, Sep 22, 2017

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 the package.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. 🐎

0reactions
scippercommented, Feb 19, 2018

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found