Skip to content

Commit

Permalink
fix: remove boundary conditions for visibility
Browse files Browse the repository at this point in the history
  • Loading branch information
jrandolf committed Nov 14, 2022
1 parent 86abe68 commit e6f7b8e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/puppeteer-core/src/injected/util.ts
Expand Up @@ -58,11 +58,11 @@ export const checkVisibility = (
const isVisible =
style &&
!HIDDEN_VISIBILITY_VALUES.includes(style.visibility) &&
isBoundingBoxVisible(element);
!isBoundingBoxEmpty(element);
return visible === isVisible ? node : false;
};

function isBoundingBoxVisible(element: Element): boolean {
function isBoundingBoxEmpty(element: Element): boolean {
const rect = element.getBoundingClientRect();
return rect.width > 0 && rect.height > 0 && rect.right > 0 && rect.bottom > 0;
return rect.width === 0 || rect.height === 0;
}

0 comments on commit e6f7b8e

Please sign in to comment.