ueberdosis / tiptap

The headless rich text editor framework for web artisans.
https://tiptap.dev
MIT License
27.14k stars 2.26k forks source link

[Bug]: Can't disable autofocus #4235

Open YevhenTarashchyk opened 1 year ago

YevhenTarashchyk commented 1 year ago

Which packages did you experience the bug in?

@tiptap/extension-character-count,@tiptap/extension-color,@tiptap/extension-history,@tiptap/extension-link,@tiptap/extension-strike,@tiptap/extension-text-align,@tiptap/extension-text-align,@tiptap/extension-text-align,@tiptap/pm,@tiptap/extension-bold,@tiptap/extension-document,@tiptap/extension-font-family,@tiptap/extension-italic,@tiptap/extension-paragraph,@tiptap/extension-text,@tiptap/extension-text-style,@tiptap/extension-underline,@tiptap/html,@tiptap/react

What Tiptap version are you using?

all higher than 2.0.0

What’s the bug you are facing?

I have a page which is scrollable and editor is at the end of a page, so on mount (once component renders) the page scrolls down to editor. I want to get rid of this behavior

const editor = useEditor( { extensions, content: value, autofocus: null, enablePasteRules: true, onUpdate: ( { editor } ) => handleContentChange( editor as Editor ), } )

Tried to change autofocus to different values and nothing helps.

What browser are you using?

Chrome

Code example

No response

What did you expect to happen?

Not to scroll to the editor view

Anything to add? (optional)

No response

Did you update your dependencies?

Are you sponsoring us?

Quenton2018 commented 9 months ago

I also encountered this issue. You might want to try setting autofocus: false instead of autofocus: null.