Default prevented on <a> click?


#1

I’m in the process of adding hyperlinks, and have found that clicking on the rendered <a> in the editor doesn’t trigger a navigation, it seems like there is a Event#preventDefault() call occurring somewhere.

Not only does this prevent the navigation, but it also prevents shift+click to set the head of a text selection from its current anchor.

Has anyone come across this and have any insight?


#2

This is how most (maybe all) browsers treat editable links—i.e. the behavior comes from the browser, not ProseMirror. You’ll see the same in TinyMCE etc. This makes sense, because trying to put the cursor in a link and then accidentally following it would be bad. A common solution is to show a tooltip below the link with a non-editable version, when the cursor is inside it.


#3

Thanks for the clarification!