From 03f016ceec483f848e23527c3b184e55e333bc5e Mon Sep 17 00:00:00 2001 From: anuradha9712 Date: Sun, 1 Sep 2024 16:09:10 +0400 Subject: [PATCH] fix(popover): add check for element in getComputeStyle function --- core/components/atoms/popperWrapper/PopperWrapper.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/components/atoms/popperWrapper/PopperWrapper.tsx b/core/components/atoms/popperWrapper/PopperWrapper.tsx index a19b23ed1..11d5472f2 100644 --- a/core/components/atoms/popperWrapper/PopperWrapper.tsx +++ b/core/components/atoms/popperWrapper/PopperWrapper.tsx @@ -322,13 +322,13 @@ export class PopperWrapper extends React.Component { const popover = this.popupRef.current as HTMLElement; const container = document.body; - const popoverIndex = parseInt(window.getComputedStyle(popover).zIndex); + const popoverIndex = popover && parseInt(window.getComputedStyle(popover).zIndex); let clickInsideLayer = false; let shouldClose = false; const openedLayers = container.querySelectorAll('[data-opened="true"]'); openedLayers.forEach((layer) => { - if (layer.contains(clicked)) { + if (layer && layer.contains(clicked)) { clickInsideLayer = true; const clickedIndex = parseInt(window.getComputedStyle(layer).zIndex); if (popoverIndex > clickedIndex) {