Open froyog opened 7 years ago
@scarlet608 : can you plz check if you face this issue here also: https://jpuri.github.io/react-draft-wysiwyg/#/ and here: https://draftjs.org/
@jpuri Nope. Sorry for the late reply. I double checked everything and it only appears in my project in Chrome 61.
The editor worked totally fine in Firefox, Edge and Safari and it even worked in Chrome 60 (before update) but failed in Chrome 61 and 63. I havn't chnaged a single line of my code. So it seems like a browser behavior.
As I mentioned before, this line caused the issue https://github.com/jpuri/react-draft-wysiwyg/blob/884424bb5eeb46d119006fbba3b66d579722ca5b/src/Editor/index.js#L336 and everthing else works perfectly fine. I am really wondering what caused the problem.
I'm having the same issue with draft-js (autofocus) and Chrome 61 (works fine in Firefox), so looks like it may likely be a Chrome bug?
That is weird, but yes can be chrome issue 😄
@icd2k3 @jpuri I finally figured out a solution to this issue by creating a new project and paste all of my code into the new one (not changing a single line of the old code). I think it might be a issue with create-react-app or chrome but copy & pasting actually fixed my issue.
When clicking the main part of the editor, the editor will focus (which is expected) but the whole page will automatically scroll to top. I did some digging to the source code and found out that when clicking, this method will be invoked https://github.com/jpuri/react-draft-wysiwyg/blob/884424bb5eeb46d119006fbba3b66d579722ca5b/src/Editor/index.js#L334 and caused the page to scroll.
I tried to fix it with an ugly apporach which save the current location first and scroll to it after focus:
This bug only seems to appear in Chorme 61.