From 0899c48117eb8c5f0dd6e6c04899f428d6734a6d Mon Sep 17 00:00:00 2001 From: riceyrice Date: Thu, 12 May 2016 13:26:50 +0100 Subject: [PATCH] Use cross-browser document.activeElement instead of (non-IE) event.target.activeElement Conflicts: CONTRIBUTORS.rst --- CHANGELOG.txt | 1 + CONTRIBUTORS.rst | 1 + docs/releases/1.4.5.rst | 1 + wagtail/wagtailadmin/static_src/wagtailadmin/js/core.js | 2 +- 4 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 6b77b881fe..29eecf43a5 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -55,6 +55,7 @@ Changelog ~~~~~~~~~~~~~~~~~~ * Fix: Paste / drag operations done entirely with the mouse are now correctly picked up as edits within the rich text editor (Matt Fozard) + * Fix: Logic for cancelling the "unsaved changes" check on form submission has been fixed to work cross-browser (Stephen Rice) 1.4.4 (10.05.2016) diff --git a/CONTRIBUTORS.rst b/CONTRIBUTORS.rst index d649ed88fd..4116fe055c 100644 --- a/CONTRIBUTORS.rst +++ b/CONTRIBUTORS.rst @@ -137,6 +137,7 @@ Contributors * Juha Yrjölä * Bojan Mihelac * Robert Moggach +* Stephen Rice Translators =========== diff --git a/docs/releases/1.4.5.rst b/docs/releases/1.4.5.rst index c523347250..5167bbb3a6 100644 --- a/docs/releases/1.4.5.rst +++ b/docs/releases/1.4.5.rst @@ -14,3 +14,4 @@ Bug fixes ~~~~~~~~~ * Paste / drag operations done entirely with the mouse are now correctly picked up as edits within the rich text editor (Matt Fozard) + * Logic for cancelling the "unsaved changes" check on form submission has been fixed to work cross-browser (Stephen Rice) diff --git a/wagtail/wagtailadmin/static_src/wagtailadmin/js/core.js b/wagtail/wagtailadmin/static_src/wagtailadmin/js/core.js index 5d7e593ae8..9af74a92cd 100644 --- a/wagtail/wagtailadmin/static_src/wagtailadmin/js/core.js +++ b/wagtail/wagtailadmin/static_src/wagtailadmin/js/core.js @@ -67,7 +67,7 @@ function enableDirtyFormCheck(formSelector, options) { window.addEventListener('beforeunload', function(event) { // Ignore if the user clicked on an ignored element var triggeredByIgnoredButton = false; - var $trigger = $(event.target.activeElement); + var $trigger = $(event.explicitOriginalTarget || document.activeElement); $ignoredButtons.each(function() { if ($(this).is($trigger)) {