From eb135d83995421614c54e9c3bb3972c9034fa9b1 Mon Sep 17 00:00:00 2001 From: Ben Date: Mon, 13 Feb 2017 17:14:15 +0000 Subject: [PATCH] Fix for issue #520 where IE11 flashed up the modal after it should have closed. --- js/ngDialog.js | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/js/ngDialog.js b/js/ngDialog.js index 8fb4ded1..12815867 100644 --- a/js/ngDialog.js +++ b/js/ngDialog.js @@ -170,10 +170,22 @@ $rootScope.$broadcast('ngDialog.closing', $dialog, value); dialogsCount = dialogsCount < 0 ? 0 : dialogsCount; if (animationEndSupport && !options.disableAnimation) { + var isIE = !!window.MSInputMethodContext && !!document.documentMode; scope.$destroy(); - $dialog.unbind(animationEndEvent).bind(animationEndEvent, function () { - privateMethods.closeDialogElement($dialog, value); - }).addClass('ngdialog-closing'); + if (!isIE) { + $dialog.unbind(animationEndEvent).bind(animationEndEvent, function () { + privateMethods.closeDialogElement($dialog, value); + }).addClass('ngdialog-closing'); + } + // Awful IE detection due to https://connect.microsoft.com/IE/feedbackdetail/view/1605631/animation-end-events-firing-late + else { + $dialog.addClass('ngdialog-closing'); + var duration = window.getComputedStyle($dialog.find(".ngdialog-content")[0]).animationDuration, + dialogAnimationDuration = (0 < duration.indexOf("ms")) ? parseFloat(duration) : parseFloat(duration) * 1000; + setTimeout(function () { + privateMethods.closeDialogElement($dialog, value); + }, dialogAnimationDuration); + } } else { scope.$destroy(); privateMethods.closeDialogElement($dialog, value);