63 votes

Added a confirmation prompt if you're leaving a page with something "unfinished"

Tags: changelog

This has been requested a number of times, sorry for all the lost comments in the meantime.

The site should now ask you to confirm if you try to leave a page with an "unfinished" topic, comment, or message. This includes starting to write new ones, but also covers the forms for editing a post. It should only trigger if you actually make any changes, so if you click "Edit" on a comment/topic, but don't edit it at all (or do, and then change the text back to what it was originally), you shouldn't get a confirmation when you leave the page.

Please let me know if you notice any issues or strange behaviors with this.

18 comments

  1. Catt
    Link
    Yay! As someone who constantly fat fingers while typing on my mobile, this will save a lot of my work!

    Yay! As someone who constantly fat fingers while typing on my mobile, this will save a lot of my work!

    13 votes
  2. [9]
    SleepyGary
    Link
    I actually kind of liked it without it. So many times I decided to abandon a comment and was somewhat happy I didn't need to confirm

    I actually kind of liked it without it. So many times I decided to abandon a comment and was somewhat happy I didn't need to confirm

    5 votes
    1. [8]
      pseudolobster
      (edited )
      Link Parent
      I'm sorta of the same opinion. I abandon half-written comments somewhat often, and the popup is fairly annoying if you're navigating away from the page intentionally. OTOH, I fully understand why...

      I'm sorta of the same opinion. I abandon half-written comments somewhat often, and the popup is fairly annoying if you're navigating away from the page intentionally.

      OTOH, I fully understand why people would want this feature. Can we maybe get a toggle for this?

      Edit: I've been saved by this feature once now, so I'll never again badmouth it. I forgot that the v and w keys are right next to each other on the dvorak layout, so it's really easy to close the window when you meant to paste.

      3 votes
      1. [2]
        Deimos
        Link Parent
        I don't think it's worth adding a setting. You can just hit Enter or click the button when it happens, it's a bit inconvenient but I can't imagine it's more than a few seconds per day in total. I...

        I don't think it's worth adding a setting. You can just hit Enter or click the button when it happens, it's a bit inconvenient but I can't imagine it's more than a few seconds per day in total.

        I don't really want to start adding settings for every tiny thing. That's how we'll end up with a settings page with 800 checkboxes to disable every minor aspect of site behavior, and the code will be far harder to work with because you always have to remember to check the relevant user setting(s) before doing anything.

        If it really bothers you, there are other options for disabling it. For example, if you're using Firefox, you can open about:config and change the setting dom.disable_beforeunload to true. That will disable these kind of "leaving the page" confirmations on all sites. I imagine there are also add-ons, tampermonkey/greasemonkey scripts, etc. that can do this pretty easily as well.

        18 votes
        1. pseudolobster
          Link Parent
          Yeah I suppose that's the best way to do it since it bugs me on reddit too.

          change the setting dom.disable_beforeunload to true.

          Yeah I suppose that's the best way to do it since it bugs me on reddit too.

          6 votes
      2. [5]
        Emerald_Knight
        Link Parent
        This is definitely one of those features where it's better to save someone from inadvertently losing a giant comment than it is to make dropping the comment ridiculously easy. If it's a matter of...

        This is definitely one of those features where it's better to save someone from inadvertently losing a giant comment than it is to make dropping the comment ridiculously easy. If it's a matter of favoring explicit action over losing potentially half an hour of work writing up a great comment, the former is definitely preferred, especially when given the goals of Tildes.

        As Deimos noted as well, there's a usability concern when you add a toggle for everything on the site, and this is one of those things that doesn't really make sense to put a toggle in for.

        I don't have the time today, but if you'd like then I'll look into writing up a quick and dirty tampermonkey script sometime in the next few days if I have the time and no one beats me to the punch. Odds are it'll end up doing just a tiny bit of DOM manipulation to remove a form attribute, so it should be short, simple, and easy for you to review to make sure it's not doing anything you're not expecting.

        9 votes
        1. [4]
          Deimos
          Link Parent
          All it would need to be is looking for any <form> with data-js-confirm-leave-page-unsaved attribute on it, and removing that attribute.

          All it would need to be is looking for any <form> with data-js-confirm-leave-page-unsaved attribute on it, and removing that attribute.

          9 votes
          1. [2]
            pseudolobster
            Link Parent
            I think this might be a good addition to Tildes Extended. Not sure who maintains it, and I'm ignorant enough about git that I don't know how to properly propose such an idea, but just throwing it...

            I think this might be a good addition to Tildes Extended. Not sure who maintains it, and I'm ignorant enough about git that I don't know how to properly propose such an idea, but just throwing it out there that it's a feature at least a couple people want, and it should be pretty trivial to implement.

            6 votes
            1. Whom
              Link Parent
              @crius does, not that tagging pings them or anything.

              @crius does, not that tagging pings them or anything.

              4 votes
          2. Emerald_Knight
            Link Parent
            I figured it would be something like that. Thanks for letting me know which attribute it is!

            I figured it would be something like that. Thanks for letting me know which attribute it is!

            2 votes
  3. Silbern
    Link
    Thank god. MY SAVIOR I just tested it out now and it works perfectly in Firefox. May there be no more comments lost to the void!

    Thank god. MY SAVIOR

    I just tested it out now and it works perfectly in Firefox. May there be no more comments lost to the void!

    4 votes
  4. balooga
    Link
    Thank you!

    Thank you!

    3 votes
  5. rodya
    Link
    Confirming that it works on desktop safari and chrome.

    Confirming that it works on desktop safari and chrome.

    2 votes
  6. Noxium
    Link
    This just saved me about an hour ago, thanks for this!

    This just saved me about an hour ago, thanks for this!

    2 votes
  7. [4]
    starchturrets
    Link
    Hmm...pressing the back button when typing comments in Endless Browser on iOS doesn’t give any pop ups. Nor does exiting.

    Hmm...pressing the back button when typing comments in Endless Browser on iOS doesn’t give any pop ups. Nor does exiting.

    1. [3]
      Deimos
      Link Parent
      Hmm, I don't know anything about Endless Browser. From a quick glance it seems to include a fair amount of javascript-blocking and similar features, so it's possible that it's blocking the...

      Hmm, I don't know anything about Endless Browser. From a quick glance it seems to include a fair amount of javascript-blocking and similar features, so it's possible that it's blocking the javascript needed for this function. I don't know if might have a setting to allow it, but it might be labeled something like "block beforeunload events" if it does.

      2 votes
      1. [2]
        starchturrets
        Link Parent
        I get pop ups when hitting the cancel button, so it’s probably not that (there’s no setting for that anyways.) Also checked in Safari, and it behaves the same. I’m guessing it’s a WebKit feature...

        I get pop ups when hitting the cancel button, so it’s probably not that (there’s no setting for that anyways.) Also checked in Safari, and it behaves the same. I’m guessing it’s a WebKit feature to prevent malicious sites from abusing pop ups.