Decorated a tags nor treated as links by browser

I’m using a MatchDecorator to transform URLs and e-mail addresses into links:

Decoration.mark({
    tagName: 'a',
    attributes: {
        href: url,
        target: '_blank',
        class: 'cmt-url'
    }
})

This resulting DOM looks correct, having <a class="cmt-url" href="…"> tags around URLs. However, the tags do not behave like links:

  • Clicking doesn’t open the URL but setting CM’s cursor
  • Hovering doesn’t show the URL at the bottom left of the browser like with all ordinary links
  • Right-clicking doesn’t show the default link entries like “Open in a new tab“ etc.

Do I need to tell CM somehow to disable Click handling in link elements?

This is how browsers treats links in editable content, and it’s not something CodeMirror can do much about. The right-click menu on such links should include link-related items.

Ah, I see. Thanks for the info. Will try to find a workaround.