diff --git a/_tests/FocusLock.spec.js b/_tests/FocusLock.spec.js
index 3fb3a13..99fc46d 100644
--- a/_tests/FocusLock.spec.js
+++ b/_tests/FocusLock.spec.js
@@ -835,6 +835,7 @@ text
)}
);
+ // will be never focused at React 17
sinon.assert.calledOnce(focusSpy);
setTimeout(() => {
expect(document.activeElement.innerHTML).to.be.equal('button-action');
@@ -864,6 +865,7 @@ text
);
+ // setTimeout(() => { // React 17
document.getElementById('portaled2').focus();
expect(document.activeElement.innerHTML).to.be.equal('i am portaled');
setTimeout(() => {
@@ -899,11 +901,13 @@ text
);
+ // setTimeout(() => { // React 17
expect(document.activeElement.innerHTML).to.be.equal('i am portaled');
setTimeout(() => {
expect(document.activeElement.innerHTML).to.be.equal('i am portaled');
done();
}, 1);
+ // },16);
});
});
diff --git a/src/Trap.js b/src/Trap.js
index 8ec1671..10c021a 100644
--- a/src/Trap.js
+++ b/src/Trap.js
@@ -171,13 +171,13 @@ const onWindowBlur = () => {
};
const attachHandler = () => {
- document.addEventListener('focusin', onTrap, true);
+ document.addEventListener('focusin', onTrap);
document.addEventListener('focusout', onBlur);
window.addEventListener('blur', onWindowBlur);
};
const detachHandler = () => {
- document.removeEventListener('focusin', onTrap, true);
+ document.removeEventListener('focusin', onTrap);
document.removeEventListener('focusout', onBlur);
window.removeEventListener('blur', onWindowBlur);
};