Skip to content

Commit

Permalink
Merge pull request #105 from leyanlo/leyan/ie
Browse files Browse the repository at this point in the history
fix: avoid crash on IE
  • Loading branch information
theKashey authored May 23, 2020
2 parents 7a6c0c9 + 1cbc9e5 commit 26b2e92
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/Trap.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,10 @@ const activateTrap = () => {
)
) {
if (document && !lastActiveFocus && activeElement && !autoFocus) {
activeElement.blur();
// Check if blur() exists, which is missing on certain elements on IE
if (activeElement.blur) {
activeElement.blur();
}
document.body.focus();
} else {
result = moveFocusInside(workingArea, lastActiveFocus);
Expand Down

0 comments on commit 26b2e92

Please sign in to comment.