-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Don't autofocus on load #197
base: main
Are you sure you want to change the base?
Conversation
If the editor has content upon initial load it will gain focus, which can cause unexpected page scrolling. This is because of using `.pasteHTML()` (which is just a wrapper around `.clipboard.dangerouslyPasteHTML()`) - doing it this way fixes the issue with autofocus. (Incidentally, credit for the fix goes to @jetzhou - see zenoamaro/react-quill#321)
Just noticed #194 -- oops! I'll update my package, hopefully the fix by @chrisladams works :) |
Thankfully #194 means this isn't needed |
Seems like this is needed. I added on watch also code that you added |
In that case, I've reopened this PR. It might be a nicer way to do it - especially if moved into a method |
You will just need to add similar thing in watch
|
Indeed, which is why I was mentioning about refactoring it into a method. Can't do it atm as I'm afk but will later if no-one else has |
This should definately be merged. |
Hi guys, I was running into this same issue. Your fix seems to work, but then causes another issue. When typing the cursor stays at the beginning of the text and spaces don't register. This is my watcher
and my component
taskForm is a prop passed form the parent. The focus and blur events just console.log a message. Any suggestions? If I remove the watcher is goes back to normal with the previous focus issue, but I can type fine. |
@surmon-china please merge this |
bump |
@surmon-china Just noticed this still hasn't been merged. Why? I haven't used the library recently, has it been fixed? (If it has then this can be closed.) |
If the editor has content upon initial load it will gain focus, which can cause unexpected page scrolling.
This is because of using
.pasteHTML()
(which is just a wrapper around.clipboard.dangerouslyPasteHTML()
) - doing it this way fixes the issue with autofocus.(Incidentally, credit for the fix goes to @jetzhou - see zenoamaro/react-quill#321)