Fix getComputedStyle running on undefined/null element
This commit is contained in:
parent
d8b0adfe97
commit
8108151fb6
|
@ -61,6 +61,7 @@ function Modal({ children, onClose, onClick, class: className }) {
|
||||||
const focusElement =
|
const focusElement =
|
||||||
modalRef.current?.querySelector('[tabindex="-1"]');
|
modalRef.current?.querySelector('[tabindex="-1"]');
|
||||||
const isFocusable =
|
const isFocusable =
|
||||||
|
!!focusElement &&
|
||||||
getComputedStyle(focusElement)?.pointerEvents !== 'none';
|
getComputedStyle(focusElement)?.pointerEvents !== 'none';
|
||||||
if (focusElement && isFocusable) {
|
if (focusElement && isFocusable) {
|
||||||
focusElement.focus();
|
focusElement.focus();
|
||||||
|
|
Loading…
Reference in a new issue