tiptap icon indicating copy to clipboard operation
tiptap copied to clipboard

[Bug]: Cursor is going away after a hard Break while loading editor within the shadow DOM environment in WebKit (Safari).

Open aagash-ni opened this issue 10 months ago • 6 comments

Which packages did you experience the bug in?

@tiptap/extension-hard-break

What Tiptap version are you using?

2.2.4

What’s the bug you are facing?

While loading the editor with hard break extension within the shadow DOM environment in WebKit (Safari), pressing Shift + Enter (HardBreak) causes the cursor to vanish.

What browser are you using?

Safari

Code example

No response

What did you expect to happen?

The cursor should appear in the new line after the hard break.

Anything to add? (optional)

While using the editor in a WebKit environment and pressing Shift + Enter (Hard Break), an error was thrown in the console, as shown below: Error Image

Upon further investigation, it appears that the issue occurs in the safariShadowSelectionRange method within the Prosemirror-view package. This problem arises because the beforeInput event is not triggered, resulting in the found variable being left undefined. Code Image

Without a shadow dom environment, it is working as expected.

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. 💖

aagash-ni avatar Apr 03 '24 06:04 aagash-ni

Could you provide a Codesandbox / Stackblitz with a Shadow DOM please so we can reproduce the error.

bdbch avatar Apr 06 '24 15:04 bdbch

Hello @bdbch, thanks for responding. Here is the Stackblitz link Tiptap Editor loaded ShadowDom https://stackblitz.com/edit/typescript-m6mkib?file=index.ts

Try doing hardBreak (Shift + Enter) in Webkit Env (Safari), the cursor will disappear

tiptap

I have reported this similar issue in Prosemirror and they suggested upgrading the prosemirror-view package to version 1.33.4. https://github.com/ProseMirror/prosemirror/issues/1454#issuecomment-2042135375

aagash-ni avatar Apr 09 '24 04:04 aagash-ni

Could you please provide an update regarding this, @bdbch?

aagash-ni avatar Apr 18 '24 05:04 aagash-ni

@bdbch, I have attempted to replicate the hardbreak workflow using tiptap version 2.3.0. The issue of the cursor disappearing still persists, but there are no errors in the console (Prosemirror-view package).

You can try it here: https://stackblitz.com/edit/typescript-m6mkib?file=index.ts.

aagash-ni avatar Apr 23 '24 10:04 aagash-ni

@bdbch Looks like aagash added the reproduction case you asked for. Could you or someone else please remove the "Needs Reproduction"/"Needs more info" tags so that this can be considered?

m-akinc avatar Jun 05 '24 17:06 m-akinc

Unfortunately, we do not have control of the prosemirror-view package so I think we would need to make something upstream for this https://github.com/ProseMirror/prosemirror-view

nperez0111 avatar Jun 06 '24 07:06 nperez0111