editor.js icon indicating copy to clipboard operation
editor.js copied to clipboard

Default link tool not working in Safari

Open MrMooky opened this issue 1 year ago • 6 comments

The default link tool is not working in Safari, even in your demo. Clicking the link icon does not trigger anything.

Screenshot 2023-10-02 at 14 54 56

When editing an existing link (set prior to the OS update), the link field shows and I can edit it.

Device, Browser, OS: macOS Sonoma (14.0), Safari 17.0

Editor.js version: Latest available

MrMooky avatar Oct 02 '23 12:10 MrMooky

Can't reproduce right away. But haven't tested in Sonoma yet. Will check.

neSpecc avatar Oct 02 '23 13:10 neSpecc

Looks like this happens in latest version of MacOS Sonoma (14) and Safari.

ChARCOOL avatar Oct 06 '23 13:10 ChARCOOL

The issue is related the anchorElement. It seems when user focus on input, Safari removes the selection so anchorElement becomes null but Chrome stores input focus as a selection.

Safari screenshot Chrome screenshot

Due to focusedElement(anchorElement) does not exist on Safari, inline toolbar closes

if (!focusedElement) {
  /**
   * If there is no selected range, close inline toolbar
   *
   * @todo Make this method more straightforward
   */
  if (!Selection.range) {
    this.Editor.InlineToolbar.close();
  }

  return;
}

link to code

suleymanbariseser avatar Oct 09 '23 10:10 suleymanbariseser

I confirm this bug on Safari 17 MacOS Sonoma. You can also reproduce this issue on your website demo.

collimarco avatar Nov 02 '23 13:11 collimarco

It worked again for me on Version 17.1 (19616.2.9.11.7).

MrMooky avatar Nov 02 '23 13:11 MrMooky

I confirm this bug again with Editor.js 2.30.2 on MacOS Sonoma 14.5, Safari 17.5. You can also reproduce this issue again on your website demo.

Previous latest minor version of Editor.js (2.29.1) works fine.

ncer avatar Jul 29 '24 09:07 ncer