Bug when adding a link to existing text via the keyboard in the WYSIWYG composer

AI-generated summary

Users reported a bug in the WYSIWYG composer where adding a link via keyboard shortcuts (e.g., pressing Enter after highlighting text) caused both the text and link to be deleted. alehandrof initially reproduced the issue on Meta using Safari 18.5 and Chrome 137.0.7151.122 in safe mode, noting it occurred when clicking the Insert button instead of pressing Enter. Lilly couldn’t reproduce it and asked for screenshots, error logs, or browser details. j.jaffeux also requested browser/version info. sam confirmed the bug, noting it involved pressing Enter in the modal. renato tried to reproduce but couldn’t on Chrome+Mac. alehandrof later confirmed the issue was resolved on Meta, thanking the team with a :slightly_smiling_face: emoji.

When I add a link to existing text via the keyboard in the WYSIWYG composer, the text (and the link) are both deleted.

How to replicate:

  • Switch to the WYSIWYG composer
  • Type a word, highlight it and press open the link dialog (either via the toolbar, or the keyboard shortcut).
  • Type anything for a link
  • Press <enter>
1 Like

hello this is a link which was added via highlighting a word in the rich text composer.

sorry I cannot reproduce this here on Meta. can you make sure you are on the latest Discourse version? if it persists, try to provide a screen recording or screenshots. Are there any errors in console? does it work in safe mode ?

2 Likes

Also please tell us your browser/version/os, thanks.

2 Likes

I can replicate the issue on Meta with Safari 18.5 and Chrome 137.0.7151.122 in safe mode.

The last step – pressing the enter key instead of clicking the “Insert” button with the mouse – is important.

1 Like

Confirmed @renato this repros, something is wonky with our handling of ENTER in the modal.

1 Like

Can you still reproduce this @alehandrof?

I just tried it on Mac+Chrome and the text/link were not deleted.

1 Like

It now works fine here on Meta. Thanks for the fix ! :slight_smile:

1 Like

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.