Post entry: Entered text deleted on enter

AI-generated summary

In a support thread titled ‘Post entry: Entered text deleted on enter,’ Arnd reports a bug in Discourse v2.3.0.beta2 where text after a mention (e.g., ‘@example: The quick brown fox’) disappears upon pressing Enter. codinghorror suggests it may be an edge case involving colons or spaces, recommending pressing Enter after completing the mention. Arnd tests multiple scenarios, finding that text deletion occurs only when a single alphanumeric word follows the mention and Enter is pressed — unless a backspace precedes Enter. zogstrip flags it as a serious issue and asks maja to investigate, warning of complexity. codinghorror believes it was previously fixed by dan and sam. zogstrip agrees to close if unreproducible. In a follow-up, Arnd confirms most cases are fixed in v2.3.0.beta3 +16, except ‘@example Something’ + Enter still deletes trailing text — but only if it’s a single word with no punctuation. zogstrip closes the issue, unable to reproduce, inviting Arnd to flag for reopening if needed.

Hello,

I encounter the following problem:

When creating a post and starting a new line with a mention immediately followed by a colon all text entered after the mention will get deleted when pressing the enter key.

Before pressing Enter:

@example: The quick brown fox

After pressingEnter:

@example

I’m on 2.3.0.beta2 +98…

Thanks, Arnd

Could be this is an edge case in completion involving the colon instead of a space?

You can try pressing enter after completing the name.

I tried different things:

  • @example + enter
    User completion pop up closes
  • @example: + enter
    User completion pop up closes after pressing : and : disappears after enter
  • @example Something + enter
    User completion pop up closes after pressing space and all text after username disappears after enter
  • @example: Something + enter
    User completion pop up closes after pressing : and all text after username disappears after enter
  • @example: Something + backspace + enter
    User completion pop up closes after pressing : but all text remains after pressing enter
    If the last character before enter is a backspace the text is not deleted

I became aware of this problem as a user encountered this and was wondering why his entered text disappeared when pressing enter…

This looks bad, we should not be deleting anything when there’s a space… @maja can you have a look? Be careful, there are lots of worms in that can.

I am pretty sure this was all fixed by @dan and @sam a while back.

Sure, @maja can close if she can’t reproduce.

I did a retest and all but one case now work fine. The only case still behaving strange is:

  • @example Something + enter
    User completion pop up closes after pressing space and all text after username disappears after enter

This only happens if a single word is entered containing only characters. It does not happen if multiple words are added (separated by space) or if there are non alpha characters (like ,, ? or ← ).

I’m on v2.3.0.beta3 +16.

Closing since I can’t reproduce this here.

@Arnd, feel free to flag to re-open if you can.