Skip to content

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

fix: Include ARIA menu containers in selector map

claude[bot]09b4d1eb04be
diff --git a/browser_use/dom/dom_tree/index.js b/browser_use/dom/dom_tree/index.js
index f1b161e5f..b9d06cb92 100644
--- a/browser_use/dom/dom_tree/index.js
+++ b/browser_use/dom/dom_tree/index.js
@@ -1297,7 +1297,12 @@
nodeData.isVisible = isElementVisible(node); // isElementVisible uses offsetWidth/Height, which is fine
if (nodeData.isVisible) {
nodeData.isTopElement = isTopElement(node);
- if (nodeData.isTopElement) {
+
+ // Special handling for ARIA menu containers - check interactivity even if not top element
+ const role = node.getAttribute('role');
+ const isMenuContainer = role === 'menu' || role === 'menubar' || role === 'listbox';
+
+ if (nodeData.isTopElement || isMenuContainer) {
nodeData.isInteractive = isInteractiveElement(node);
// Call the dedicated highlighting function
nodeWasHighlighted = handleHighlighting(nodeData, node, parentIframe, isParentHighlighted);