Navigation with minimized topic draft can trigger abandon dialog

Hi there, hope everyone is having a great day :grinning:

I noticed some interesting differences in behavior between navigating around Discourse with a topic draft editor expanded vs minimized.

If the topic editor is minimized, any time you navigate from a topic to a category, you get prompted with the ā€œabandon postā€ dialog. If the editor is fully expanded and you navigate in the same manner, the dialog does not appear.

Is this behavior intentional or a bug? The main reason I could see this as intentional is to remind you that you have a draft it progress, but it seems odd to bring up the ā€œabandon postā€ dialog simply upon navigation. It feels like that dialog should be reserved for when you click ā€œNew Topic.ā€ If the main idea was to remind the user, it seems more appropriate to either automatically expand a minimized draft or display some type of reminder dialog.

Let me know what you think or if I need to be any clearer in what Iā€™m trying to explain!

4 Likes

Just topic draft does this, or reply draft?

Iā€™ve only had it happen with the topic draft. I just tried it with a reply draft and couldnā€™t reproduce it.

Iā€™m just starting to try to familiarize myself with Discourse code, so this may be a dumb suggestion, but I did some digging and there was a fix made a few years ago:

https://github.com/discourse/discourse/commit/359f03ca73f92bcc8bf25140ab96e2b9b8cc87f7#diff-63b31ab42d152f878f4fb06d7e6b4775

I saw this addition:

  // If there's a draft, open the create topic composer
  if (model.draft) {
    this.controllerFor('composer').open({
      action: Discourse.Composer.CREATE_TOPIC,
      draft: model.draft,
      draftKey: model.draft_key,
      draftSequence: model.draft_sequence
    });
  }

Would an action like that being called during navigation be whatā€™s producing what appears to be the behavior you would expect if you clicked the ā€œNew Topicā€ button with a draft in place?

1 Like

Hereā€™s a screen recording of the issue. You will see the issue as I navigate to a couple of different categories with the editor minimized, then at the end I show that there is no issue when the editor is expanded.

https://streamable.com/1cri9

3 Likes

I am going to close this as stale, @tshenry flag if this is still an issue in light of the topic draft changes I made.

1 Like