mirror of
https://github.com/cheeaun/phanpy.git
synced 2025-03-13 09:28:50 +01:00
Fix getComputedStyle running on undefined/null element
This commit is contained in:
parent
d8b0adfe97
commit
8108151fb6
1 changed files with 1 additions and 0 deletions
|
@ -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