Uploaded image for project: 'Confluence Data Center'
  1. Confluence Data Center
  2. CONFSERVER-16075

When editing, prompt the user for confirmation if they close the tab or window or navigate to a different page.

    • We collect Confluence feedback from various sources, and we evaluate what we've collected when planning our product roadmap. To understand how this piece of feedback will be reviewed, see our Implementation of New Features Policy.

      From Per:

      "When closing a tab or window while in edit-mode, a Javascript Window should ask me if I am sure. While the draft is for pages, many people won't even know how that works, and comments will be lost. I reckon that in 90% of the time, users don't want to cancel an editing session, and closing the tab is an accident. Even navigating to a different page when in edit mode is most likely a mistake. Happens to me frequently."

      If a user is in Edit mode and they close this tab or window, ask them "You are currently editing [Page Name / News Item]. Are you sure you want to leave?"

      If a user is in Edit mode and they navigate to a different page, ask them "You are currently editing [Page Name / News Item]. Are you sure you want to go somewhere else?"

            [CONFSERVER-16075] When editing, prompt the user for confirmation if they close the tab or window or navigate to a different page.

            Brian Nguyen (Inactive) added a comment - https://atlaseye.atlassian.com/cru/CR-CONF-353

            1. Ignoring for now.
            2. The template link is special, so I've added a custom confirmation that says "Your changes will be overwritten" or something to that effect
            3. Done.
            4.1 Not yet done
            4.2 I've added some rules so that the popup only appears if:

            • A draft has been saved
            • If not, whether the content has changed (adding text and then deleting it counts as changed).

            Brian Nguyen (Inactive) added a comment - 1. Ignoring for now. 2. The template link is special, so I've added a custom confirmation that says "Your changes will be overwritten" or something to that effect 3. Done. 4.1 Not yet done 4.2 I've added some rules so that the popup only appears if: A draft has been saved If not, whether the content has changed (adding text and then deleting it counts as changed).

            4.2 - Further - We already save a draft for content types with drafts on page unload, so the hasContentChanged check won't help for these types because it will always return false. Potentially we could now skip the draft save and let the user make the decision, or just stick the draft save after the user presses Cancel.

            David Taylor (Inactive) added a comment - 4.2 - Further - We already save a draft for content types with drafts on page unload, so the hasContentChanged check won't help for these types because it will always return false. Potentially we could now skip the draft save and let the user make the decision, or just stick the draft save after the user presses Cancel.

            3. You can add custom text. Just return the message from the event handler or add it to the event depending on which browser you're in. https://developer.mozilla.org/en/DOM/window.onbeforeunload

            David Taylor (Inactive) added a comment - 3. You can add custom text. Just return the message from the event handler or add it to the event depending on which browser you're in. https://developer.mozilla.org/en/DOM/window.onbeforeunload

            4.2 - We have a hasContentChanged() function in page-editor.js that handles both the RTE and Wiki Markup. Regardless of user setting I think the message shouldn't appear if there is nothing to lose, this would benefit from some UI flag like "Editing..." next to the Save button showing that there were unsaved changes.

            David Taylor (Inactive) added a comment - 4.2 - We have a hasContentChanged() function in page-editor.js that handles both the RTE and Wiki Markup. Regardless of user setting I think the message shouldn't appear if there is nothing to lose, this would benefit from some UI flag like "Editing..." next to the Save button showing that there were unsaved changes.

            1. I don't think this is terribly important.
            2. That's interesting. For this to work, we probably need smart rules on when to show it. You don't want it to pop up all the time when trying out different templates. Better not to have it on templates than to make it too annoying. If at all, it should propably only pop up for the first template change in a session?
            3. AFAIK this is a hardcoded message by the browser: "The default statement that appears in the dialog box, "Are you sure you want to navigate away from this page? ... Press OK to continue, or Cancel to stay on the current page.", cannot be removed or altered.",. see http://msdn.microsoft.com/en-us/library/ms536907(VS.85).aspx
            4.1. I assume this is primarily important when developing (or testing), but yes, a setting would be good
            4.2 If there is a way to do this (draft-saving does this), we should try to use the same mechanism.

            Per Fragemann [Atlassian] added a comment - 1. I don't think this is terribly important. 2. That's interesting. For this to work, we probably need smart rules on when to show it. You don't want it to pop up all the time when trying out different templates. Better not to have it on templates than to make it too annoying. If at all, it should propably only pop up for the first template change in a session? 3. AFAIK this is a hardcoded message by the browser: "The default statement that appears in the dialog box, "Are you sure you want to navigate away from this page? ... Press OK to continue, or Cancel to stay on the current page.", cannot be removed or altered.",. see http://msdn.microsoft.com/en-us/library/ms536907(VS.85).aspx 4.1. I assume this is primarily important when developing (or testing), but yes, a setting would be good 4.2 If there is a way to do this (draft-saving does this), we should try to use the same mechanism.

            1. This has not been done for Profile, as specified above
            2. The confirmation does not appear when templates are available, and the user clicks on the link "Select a page template to start from" after entering text
            3. The confirmation text says "Are you sure you want to navigate away from this page?" There is no clue given about why you might not want to - that is: it would be a better message if it said something like "...because you still have unsaved changes..."
            4. The confirmation can be quite annoying. Is it possible to:
              1. Provide a configuration setting to turn the feature off
              2. Only show the confirmation if there in fact unsaved changes to be lost. i.e. user can click add/edit, not enter anything, and then cancel the edit by navigating away, without being prompted to confirm.

            Mark Hrynczak (Inactive) added a comment - - edited This has not been done for Profile, as specified above The confirmation does not appear when templates are available, and the user clicks on the link "Select a page template to start from" after entering text The confirmation text says "Are you sure you want to navigate away from this page?" There is no clue given about why you might not want to - that is: it would be a better message if it said something like "...because you still have unsaved changes..." The confirmation can be quite annoying. Is it possible to: Provide a configuration setting to turn the feature off Only show the confirmation if there in fact unsaved changes to be lost. i.e. user can click add/edit, not enter anything, and then cancel the edit by navigating away, without being prompted to confirm.

            Assigning this to you since Chris is no longer.

            Stephen Russell [Atlassian] added a comment - Assigning this to you since Chris is no longer.

            Done. We use the onbeforeunload handler, as documented here:

            http://msdn.microsoft.com/en-us/library/ms536907(VS.85).aspx

            Tested in IE6, IE7, FF2, FF3, Safari 4.

            Unfortunately due the nature of this handler, it can't really be tested with Selenium.

            Chris Broadfoot [Atlassian] added a comment - Done. We use the onbeforeunload handler, as documented here: http://msdn.microsoft.com/en-us/library/ms536907(VS.85).aspx Tested in IE6, IE7, FF2, FF3, Safari 4. Unfortunately due the nature of this handler, it can't really be tested with Selenium.

            Just to make sure: This specifically applies to blogposts and comments as well. And anywhere else where you can edit larger chunks of text and accidentally leave the screen (e.g. when editing your profile)

            Per Fragemann [Atlassian] added a comment - Just to make sure: This specifically applies to blogposts and comments as well. And anywhere else where you can edit larger chunks of text and accidentally leave the screen (e.g. when editing your profile)

              bnguyen Brian Nguyen (Inactive)
              srussell Stephen Russell [Atlassian]
              Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: