m-e-conroy / angular-dialog-service

A complete AngularJS service with controllers and templates for generating application modals and dialogs for use with Angular-UI-Bootstrap and Twitter Bootstrap

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Closing dialog throws exception in IE-10

vitaly-t opened this issue · comments

When closing a dialog, an exception is thrown by the library:

Unable to get property 'focus' of undefined or null reference

        $modalStack.close = function (modalInstance, result) {
          var modalWindow = openedWindows.get(modalInstance);
          if (modalWindow && broadcastClosing(modalWindow, result, true)) {
            modalWindow.value.deferred.resolve(result);
            removeModalWindow(modalInstance);
            modalWindow.value.modalOpener.focus();
            return true;
          }
          return !modalWindow;
        };

The exception is pointing at the following line.

modalWindow.value.modalOpener.focus();

Evidently, modalWindow.value.modalOpener is either null or undefined, unexpectedly.

I'm using IE10 + AngularJS 1.3.17 + angular-dialog-service 5.2.8

The issue doesn't exist in the latest Chrome or Firefox, seems just IE-related.

Could you please create a jsfiddle that reproduces this so we can take a look. Do you see this in ie11?

I do not have IE11 here to verify. And the scenario is fairly complex to be able to reproduce on jsfiddle, as explained below...

In my page when a button is clicked, it initializes an external window through integrated ActiveX, which automatically grabs the focus away from the browser window. Somehow this seems to ruin the focus logic inside the dialog.

I believe the issue is within the ui bootstrap library, as was shown earlier.

Just found out the issue was previously reported and fixed: angular-ui/bootstrap#3653, just not released yet.

commented

This issue exist on IE 11 as well. I have been reported and needs to fix this on my app as well. I wonder if the #3653 was the solution or is it been closed for some other reason.

Looks like #3653 issue was already fixed on v 0.13.1