U4-4902 - Enable 'discard changes' alert throughout the UI

Created by Douglas Robar 14 May 2014, 10:36:01 Updated by Jose Marcenaro 01 Sep 2018, 23:23:01

Tags: PR

Is duplicated by: U4-4988

Relates to: U4-6265

Relates to: U4-6515

Relates to: U4-7484

Relates to: U4-8143

Relates to: U4-9996

Relates to: CON-1438

Relates to: U4-10725

Subtask of: U4-9609

The "Discard changes" alert works when you move from one content page to another.

It should work when leaving an unsaved template, razor code, js, css, etc as well.


Jeroen Breuer 25 Jul 2014, 11:24:21

Some other issues about the "discard changes" feature:

  • If you change the media or content picker and you navigate away you don't get the "Discard changes" message. Might be other (custom) property editors that have the same problem.

  • If you navigate really fast between nodes you also get the "discard changes" message even if you didn't change anything.

Jeroen Breuer 05 Aug 2014, 12:06:40

Another issue: If you navigate away from content to another section and you click 'discard changes' it doesn't open the node in the other section, but only goes to that section with the default dashboards open.

Matthew 11 Feb 2015, 18:03:19

Simply clicking in a rich text editor and the navigating away, without changing anything, will display the "discard changes" message.

Jeroen Breuer 31 Jan 2016, 15:59:35

"If you navigate really fast between nodes you also get the "discard changes" message even if you didn't change anything." This is still happening in Umbraco 7.4-beta2 and is still very annoying.

Eric Schrepel 11 Mar 2016, 17:48:51

Indeed, we get far too many "discard changes" notices; for any nodes where "list view" is enabled, merely trying to pick a node from the list view brings up the Discard changes notice. And as mentioned by Matthew, sometimes just opening a node and not touching anything still brings up the Discard notice when navigating to another node. We're on 7.4.1

Anders Bjerner 30 Mar 2016, 13:14:55

As already mentioned a bit, there are a few "false positives" around the Umbraco backoffice as well. This occurs in the list view and in dashboards - eg. playing around with the Examine dashboard will usually result in the "Discard changes" message when browsing away.

Zoki 19 Apr 2017, 08:19:29

This feature is broken, triggers when it shouldn't too many times. I'm not sure if that's easily fixable or not, but I know I'd rather have it turned off than to annoy people.

Jeroen Breuer 26 Jun 2017, 08:24:43

It would be nice to have an option to disable "discard changes" completely. It's driving me crazy. Each time I search for a member and want to open it I get this message. It's a broken feature so I would like to disable it.

Mads Krohn 26 Jun 2017, 09:08:34

It indeed seems a bit broken, but I do understand the complications in implementing this correctly. Until time can be set aside to fix this in a thoroughly manner, perhaps an option to disable it, as Jeroen suggested, would be the best choice.

Shannon Deminick 26 Jun 2017, 23:56:32

@jbreuer disabling the feature doesn't 'fix' the issue. The issue should just be fixed. It's probably rather easy, some text boxes just need to be attributed so that the change tracking is ignored. There's probably a few places in the back office that are just missing the "no-dirty-check" attribute (i.e searching for a member), for example: https://github.com/umbraco/Umbraco-CMS/blob/9badb35c054ecc91630b69b1b6753c78427cb4a6/src/Umbraco.Web.UI.Client/src/views/dashboard/developer/examinemanagement.html#L217 Feel free to send a PR :)

Marcin Zajkowski 02 Nov 2017, 16:43:39

PR created: https://github.com/umbraco/Umbraco-CMS/pull/2298

Shannon Deminick 02 Nov 2017, 23:47:21

Please don't set issues to "Fixed", this is the job of the HQ once a PR is merged and then we tag it to a release. If you mark as fixed, it will get lost in the abyss since it will be considered already done.

Robert Copilau 10 Jan 2018, 09:21:14

I have found out that the culprit for the false-positives is how no-dirty-check directive works. Before it used the focus event to set the ctrl.$pristine = false, which it didn't worked unless you manually focused on the input.


  • A delay of 1 second is needed to fix this however that is too much, and chances are that you start typing before the second ends.
  • Using scope.$watch seems to fix the issue entirely. Wrapping the watch in elm.focus brings the watch calls to a minimum.

NOTE: *Setting directive priorities does not work *Only watching the element, model, ctrl does not work

PR: https://github.com/umbraco/Umbraco-CMS/pull/2379

Mads Rasmussen 11 Jan 2018, 10:02:16

Wonderfull! I have merged the PR which adds no-dirty-checks to a lot of places in the UI. Hopefully, this will help make the feature feel less broken. If we missed any feel free to open a new issue and PR.

Thanks @m.zajkowski for the great work!

Marcin Zajkowski 11 Jan 2018, 10:10:10

That's a great news @madsrasmussen! I was using this custom build for some time already and I felt a change :)

Brian Powell 24 Jan 2018, 01:36:52

The problem fro U4-9996, where the "discard changes" alert displays when it shouldn't when uploading files, still exists in v7.7.9.

Robert Copilau 24 Jan 2018, 08:04:39

Hey @bitmapped, thanks for your input - I can confirm the issue and we will be looking at it as soon as we can.

Sebastiaan Janssen 24 Jan 2018, 08:42:59

As said, we don't want to pretend that this covers all cases, but we can't keep this issue open forever, much better to have a few more related issues open so we can fix them one by one easily.

Jose Marcenaro 01 Sep 2018, 23:23:01

It looks like the "no check" fix went too far. The MultiTreeNodePicker2 is not setting the $dirty flag when adding items (it does when removing) - using v7.12.1

Priority: Normal

Type: Usability Problem

State: Fixed


Difficulty: Normal

Category: UI

Backwards Compatible: True

Fix Submitted: Pull request

Affected versions: 7.4.2, 7.5.14, 7.6.3

Due in version: 7.7.9

Sprint: Sprint 76

Story Points: 1

Cycle: 7