Skip to content
This repository was archived by the owner on May 29, 2019. It is now read-only.
This repository was 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

@Hjertaas

Description

@Hjertaas

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)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions