File tree 1 file changed +17
-4
lines changed
1 file changed +17
-4
lines changed Original file line number Diff line number Diff line change @@ -40,13 +40,26 @@ exports.returnFocus = function() {
40
40
41
41
exports . setupScopedFocus = function ( element ) {
42
42
modalElement = element ;
43
- window . addEventListener ( 'blur' , handleBlur , false ) ;
44
- document . addEventListener ( 'focus' , handleFocus , true ) ;
43
+
44
+ if ( window . addEventListener ) {
45
+ window . addEventListener ( 'blur' , handleBlur , false ) ;
46
+ document . addEventListener ( 'focus' , handleFocus , true ) ;
47
+ } else {
48
+ window . attachEvent ( 'onBlur' , handleBlur ) ;
49
+ document . attachEvent ( 'onFocus' , handleFocus ) ;
50
+ }
45
51
} ;
46
52
47
53
exports . teardownScopedFocus = function ( ) {
48
54
modalElement = null ;
49
- window . removeEventListener ( 'blur' , handleBlur ) ;
50
- document . removeEventListener ( 'focus' , handleFocus ) ;
55
+
56
+ if ( window . addEventListener ) {
57
+ window . removeEventListener ( 'blur' , handleBlur ) ;
58
+ document . removeEventListener ( 'focus' , handleFocus ) ;
59
+ } else {
60
+ window . detachEvent ( 'onBlur' , handleBlur ) ;
61
+ document . detachEvent ( 'onFocus' , handleFocus ) ;
62
+ }
51
63
} ;
52
64
65
+
You can’t perform that action at this time.
0 commit comments