fix(browser-extension): edge case where no height

This commit is contained in:
wanhose 2023-05-20 20:17:07 +02:00
parent dc5860214f
commit 605b63223d

View File

@ -90,7 +90,10 @@ const isInViewport = (node) => {
const position = node.getBoundingClientRect(); const position = node.getBoundingClientRect();
const scroll = window.scrollY || window.pageYOffset; const scroll = window.scrollY || window.pageYOffset;
return scroll + position.top <= scroll + height && scroll + position.bottom >= scroll; return (
position.bottom === position.top ||
(scroll + position.top <= scroll + height && scroll + position.bottom >= scroll)
);
}; };
/** /**