tiptap icon indicating copy to clipboard operation
tiptap copied to clipboard

[Bug]: React `useEditor` option `autofocus` doesn't work since 2.2.0

Open jiegillet opened this issue 11 months ago • 1 comments

Which packages did you experience the bug in?

react

What Tiptap version are you using?

2.2.4

What’s the bug you are facing?

Setting the option autofocus: true (or other values like start or end) doesn't have any effect since 2.2.0.

What browser are you using?

Chrome

Code example

https://codesandbox.io/p/sandbox/cranky-boyd-x7c33h?file=%2Fsrc%2FApp.js

What did you expect to happen?

When loading the editor, it should be focused when autofocus is set.

Anything to add? (optional)

The code example I provided only has the autofocus: true line added from the default template. With the tiptap dependencies changed to to 2.1.16, the autofocus works, but no version after that.

Did you update your dependencies?

  • [X] Yes, I’ve updated my dependencies to use the latest version of all packages.

Are you sponsoring us?

  • [ ] Yes, I’m a sponsor. 💖

jiegillet avatar Mar 22 '24 05:03 jiegillet

Im doing this for now - on EditorProvider

    editorProps={{
      attributes: {
        ...(props.autoFocus ? { autofocus: "true" } : {}),
      },
    }}

hjoelh avatar Apr 30 '24 15:04 hjoelh

Seems to have been fixed on 2.5.4 (possibly before)

jiegillet avatar Jul 25 '24 07:07 jiegillet

Can confirm, has been fixed in React

nperez0111 avatar Jul 26 '24 19:07 nperez0111