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

fix(modal): stop IE throwing exception on focus #5097

Closed
wants to merge 2 commits into from
Closed

fix(modal): stop IE throwing exception on focus #5097

wants to merge 2 commits into from

Conversation

Hadev-JHH
Copy link
Contributor

check if the element the model is appended to supports focus before actually calling focus to stop IE from causing exceptions and breaking the angular app

fixes #5096

check if the element the model is appended to supports focus before actually calling focus.
@@ -309,7 +309,9 @@ angular.module('ui.bootstrap.modal', ['ui.bootstrap.stackedMap'])
if (elementToReceiveFocus && elementToReceiveFocus.focus) {
elementToReceiveFocus.focus();
} else {
appendToElement.focus();
if(appendToElement.focus) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is probably better put on the else, i.e.

else if (appendToElement.focus) {
  appendToElement.focus();
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah yes, good point indeed. completely overlooked that after console.log debugging i guess

@wesleycho wesleycho added this to the 1.0.0 milestone Dec 18, 2015
@wesleycho wesleycho closed this in a5c2a5b Dec 18, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

IE throws exceptions on removeModalWindow on close from javascript
2 participants