···
90
+
const opts = { capture: true } as any;
91
+
const touchOpts = { capture: true, passive: false } as any;
91
-
root.addEventListener('focusout', onFocusOut, true);
92
-
root.addEventListener('focusin', onFocusIn, true);
94
+
root.addEventListener('focusout', onFocusOut, opts);
95
+
root.addEventListener('focusin', onFocusIn, opts);
95
-
root.addEventListener('click', onClick, true);
96
-
root.addEventListener('touchstart', onClick, true);
97
-
root.addEventListener('keydown', onKey, true);
98
+
root.addEventListener('click', onClick, opts);
99
+
root.addEventListener('touchstart', onClick, touchOpts);
100
+
root.addEventListener('keydown', onKey, opts);
101
-
root.removeEventListener('focusout', onFocusOut, true);
102
-
root.removeEventListener('focusin', onFocusIn, true);
104
+
root.removeEventListener('focusout', onFocusOut, opts);
105
+
root.removeEventListener('focusin', onFocusIn, opts);
105
-
root.removeEventListener('click', onClick, true);
106
-
root.removeEventListener('touchstart', onClick, true);
107
-
root.removeEventListener('keydown', onKey, true);
108
+
root.removeEventListener('click', onClick, opts);
109
+
root.removeEventListener('touchstart', onClick, touchOpts);
110
+
root.removeEventListener('keydown', onKey, opts);
}, [ref.current, hasPriority, disabled, focusLoss]);