Skip to content
This repository has been archived by the owner on May 29, 2019. It is now read-only.

Modal close fails in IE if modal was opened from js #3639

Closed
Hjertaas opened this issue May 7, 2015 · 7 comments
Closed

Modal close fails in IE if modal was opened from js #3639

Hjertaas opened this issue May 7, 2015 · 7 comments

Comments

@Hjertaas
Copy link

Hjertaas commented May 7, 2015

See stacktrace at the bottom.

Using angular: 1.4.0-beta.5 and angular-bootstrap: 0.13.0
Error seen on IE 9 and 11 (others not tested)

If modal dialog is initiated from javascript (say an Angular controller) there is no activeElement
See line 2209 in ui-bootstrap-tpls.js
var modalOpener = $document[0].activeElement; // in IE this is undefined

This in turn results in a nullpointer in close() and dismiss() functions. Lines 2262 and 2273 respectively.

We are temporarily rectifying this by running this
if (!window.document.activeElement) {
window.document.body.focus();
}
immediately prior to calling $modal.open()

TypeError: Unable to get property 'focus' of undefined or null reference
at $modalStack.close (http://localhost:9000/ext/angular-bootstrap/ui-bootstrap-tpls.js:2262:11)
at modalInstance.close (http://localhost:9000/ext/angular-bootstrap/ui-bootstrap-tpls.js:2340:17)
at fn (Function code:2:191)
at callback (http://localhost:9000/ext/angular/angular.js:22335:17)
at Scope.prototype.$eval (http://localhost:9000/ext/angular/angular.js:15236:9)
at Scope.prototype.$apply (http://localhost:9000/ext/angular/angular.js:15335:11)
at Anonymous function (http://localhost:9000/ext/angular/angular.js:22340:17)
at jQuery.event.dispatch (http://localhost:9000/ext/jquery/dist/jquery.js:4664:6)
at elemData.handle (http://localhost:9000/ext/jquery/dist/jquery.js:4332:5)
at jQuery.event.dispatch (https://example.com/plugins.3619bc3f.js:3:14958)
at elemData.handle (https://example.com/plugins.3619bc3f.js:3:9674)

@rvanbaalen
Copy link
Contributor

We don't support AngularJS 1.4 yet.

@karianna
Copy link
Contributor

karianna commented May 7, 2015

Still a valid issue though, putting a 0.13.x milestone on it (e.g. Fix when we get round to looking at 1.4 support)

@karianna karianna reopened this May 7, 2015
@rvanbaalen
Copy link
Contributor

I get your point @karianna. But I would have to disagree on the part where this would be a 'valid issue'. Yes, this is probably a bug in UI Bootstrap. But like I said -- no one is stating that UI Bootstrap is expected to work with the latest beta AngularJS version.

If we would accept all these issues (and even without plunkrs to reproduce it!), next time we'll get a bunch of new issues about people reporting that UI Bootstrap is not compatible with AngularJS 2.0 developer preview.

Personally, I'm all about closing issues fast and keep the amount of open issues to a minimum. Everyone can re-add an issue as soon as a stable AngularJS release is out and this is still reproducible. Lets discuss that policy with the rest of the team.

@karianna karianna removed this from the 0.13.x milestone May 7, 2015
@karianna karianna added this to the Purgatory milestone May 7, 2015
@karianna
Copy link
Contributor

karianna commented May 7, 2015

Ah, I missed that this is angular 1.4 Beta. OK, I'm going to shove this into purgatory for now.

@pkozlowski-opensource
Copy link
Member

My take would be to have issues (or one meta-issue) for 1.4 support and a corresponding label / milestone. 1.4 is round-the-corner and pretty stable. There were substential changes in animatations support in 1.4, so this will be probably the only area where migration efforts will be needed.

As for the 2.0 support - we should make it clear that the project, in the current form, focuses on 1.x.

@karianna
Copy link
Contributor

karianna commented May 7, 2015

OK, well we've attached the label, so this should be easy enough to find

@tompi
Copy link
Contributor

tompi commented May 11, 2015

Hi, this has nothing to do with angular version.

It seems activeElement can be flaky in IE.

Try this plnkr in IE:
http://plnkr.co/edit/l48KCXXtqOHs0qV2pqhz?p=preview

If you have the console open you will notice a javasccript exception.
I'll try to attach a pull request.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants