Skip to content

Open-source Python library for AI browser agents, plus Browser Use Cloud: stealth browsers and a hosted agent API.

Fix special case for viewport expansion in visibility check

Zhen3rc0754f26c603
diff --git a/browser_use/dom/buildDomTree.js b/browser_use/dom/buildDomTree.js
index 539c76225..4e977cafd 100644
--- a/browser_use/dom/buildDomTree.js
+++ b/browser_use/dom/buildDomTree.js
@@ -391,7 +391,7 @@
rect.top > window.innerHeight + viewportExpansion ||
rect.right < -viewportExpansion ||
rect.left > window.innerWidth + viewportExpansion
- );
+ ) || viewportExpansion === -1;
// Check parent visibility
const parentElement = textNode.parentElement;