From 63f84fa244b0379bd2b551b4a920ddb43201c76c Mon Sep 17 00:00:00 2001 From: Johnathan Ludwig Date: Fri, 2 Jul 2021 10:51:21 -0400 Subject: [PATCH] fix: event propogation in react 17 In react 17 the order of events changed. Trap was previously capturing the event which caused issues like being unable to focus on content that is inside a portal. re #134 --- src/Trap.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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); };