From d88d40bdd084ffd540e33304f249a924002e579b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrik=20S=C3=B6derberg?= Date: Tue, 12 Oct 2021 18:43:36 +0200 Subject: [PATCH] Don't detect component as visible when it or parent has display:none --- src/index.jsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/index.jsx b/src/index.jsx index 39c1505..b0eb317 100644 --- a/src/index.jsx +++ b/src/index.jsx @@ -161,7 +161,8 @@ const checkVisible = function checkVisible(component) { const visible = isOverflow ? checkOverflowVisible(component, parent) : checkNormalVisible(component); - if (visible) { + const hasPosition = node.offsetParent !== null; // check for display:none + if (hasPosition && visible) { // Avoid extra render if previously is visible if (!component.visible) { if (component.props.once) {