The whole inline-toolbar recreates itself endlessly when opening link-toolbar
It's a very strange bug which becomes quite obvious and visible if you add a bit of transitions to the .ce-toolbar__content. For some reason if you open link-submenu the whole inline-toolbar gets recreated and repopulated endlessly until you click on an input element (make it focused). It doesn't happen on link creation because then the input gets focused initially, but when you try to edit a link, that's when the input doesn't get focused and the whole bug begins. At least, that's what I presumed at first but then I discovered that you can click anywhere inside the inline toolbar (not only input) and the vigorous recreation stops.
Steps to reproduce:
- Type some text
- Select some parts of it and turn it into a link
- Close the inline toolbar
- Double click on the created link to open the inline toolbar
Expected behavior:
- The inline toolbar elements should be created only once (at the init of editorjs or when you open the inline toolbar)
- It should work properly with transitions and animations to allow for open and close animations
You can see the bug in action here: https://github.com/user-attachments/assets/9c773f95-1f0f-4285-ad38-3c4a93dd8d3b
OS: Window 11 Browser: Google Chrome 128.0.6613.114 Editor.js version: 2.30.5
I patch this bug a dirty way by focusing the link input during renderActions :
setTimeout(() => this.nodes.input.focus(), 0)
I dig a little bit more, the bug come from the update of this.nodes.input.value on checkState.
It's related to selectionchange's listener
I can't find a way to stop propagation from outside editor.js
Same issue for here
change the this.nodes.input.value = href to this.nodes.input.setAttribute('value', href); in checkState make it stop re-render for me.