1
0
Fork 0

Fix getComputedStyle running on undefined/null element

This commit is contained in:
Lim Chee Aun 2024-03-02 18:54:27 +08:00
parent d8b0adfe97
commit 8108151fb6

View file

@ -61,6 +61,7 @@ function Modal({ children, onClose, onClick, class: className }) {
const focusElement =
modalRef.current?.querySelector('[tabindex="-1"]');
const isFocusable =
!!focusElement &&
getComputedStyle(focusElement)?.pointerEvents !== 'none';
if (focusElement && isFocusable) {
focusElement.focus();