fix: remove boundary conditions for visibility (#9249)
Fixed: https://github.com/puppeteer/puppeteer/issues/9232
This commit is contained in:
parent
86abe68849
commit
e003513c0c
@ -58,11 +58,11 @@ export const checkVisibility = (
|
|||||||
const isVisible =
|
const isVisible =
|
||||||
style &&
|
style &&
|
||||||
!HIDDEN_VISIBILITY_VALUES.includes(style.visibility) &&
|
!HIDDEN_VISIBILITY_VALUES.includes(style.visibility) &&
|
||||||
isBoundingBoxVisible(element);
|
!isBoundingBoxEmpty(element);
|
||||||
return visible === isVisible ? node : false;
|
return visible === isVisible ? node : false;
|
||||||
};
|
};
|
||||||
|
|
||||||
function isBoundingBoxVisible(element: Element): boolean {
|
function isBoundingBoxEmpty(element: Element): boolean {
|
||||||
const rect = element.getBoundingClientRect();
|
const rect = element.getBoundingClientRect();
|
||||||
return rect.width > 0 && rect.height > 0 && rect.right > 0 && rect.bottom > 0;
|
return rect.width === 0 || rect.height === 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user