"Esc" keyboard shortcut not working properly in edition mode

How to reproduce:

  1. Go to one of your post and click Edit to open the composer. Don’t type anything.
  2. Press the Esc key => as expected, the composer disappears completely (it isn’t minimized, because the post hasn’t been modified).
  3. Refresh the browser page => the composer comes back.

In step 2, if you click the Cancel button instead of pressing the Esc key, the behavior is correct, i.e. the composer doesn’t come back after browser refresh.

5 „Gefällt mir“

@jack2

I just did it, Yes it does exactly what you say. Not sure if it’s a bug or its suppose to do this actually.

3 „Gefällt mir“

I can’t repro this anymore, can you still repro this on try.discourse.org please ?

Yes, I’ve jus reproduced it on try.discourse.org.

Wait! It’s random! Sometimes it doesn’t occur.

Are you able to find a consistent repro? I have an idea for a fix, but I would prefer to have a consistent repro. Please.

1 „Gefällt mir“

Here is a consistent repro:

  1. Go to one of your post and click Edit to open the composer. Don’t type anything.
  2. Wait a few seconds, until a check mark appears at the bottom right of the composer
  3. Press the Esc key => as expected, the composer disappears completely (it isn’t minimized, because the post hasn’t been modified).
  4. Refresh the browser page => the composer comes back.
2 „Gefällt mir“

Nice! Ok so my fix idea will probably work, thanks hugely appreciated :heart:

3 „Gefällt mir“

This was way more trickier than expected, I think this should fix it:

https://github.com/discourse/discourse/pull/9305

I have asked multiple reviews and it might take time to merge, thanks again for the detailed repro :+1:

5 „Gefällt mir“

Quick update, I just closed the PR. The fix was working, but we are going to try to fix it at a higher level.

Might take some time :slight_smile:

4 „Gefällt mir“

I did this fix:

https://github.com/discourse/discourse/commit/a34711c23a58c991e44af2ff5e62f618107b244d

This file is mega tricky @eviltrout … can not wait till we have support for async cause a big pile of methods sometimes return a promise and sometimes return an object making it very hard to reason about things.

For now I introduced a few promises and bypasses so we do not save a draft right away after you click the edit button. This was also driving @supermathie crazy cause it made it really complicated and annoying to copy text from N replies into the OP.

7 „Gefällt mir“

This explains a lot of frustration I was having, :clap:

4 „Gefällt mir“

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