Backported Chrome omnibox fix from Orca.

This commit is contained in:
Storm Dragon
2026-05-15 15:48:52 -04:00
parent b224d699c0
commit 0acba6a733
3 changed files with 105 additions and 2 deletions
+30 -2
View File
@@ -148,14 +148,42 @@ class AXObject:
if not toolkit_name.startswith("qt"):
return False
if not AXObject._can_reach_application(obj):
tokens = ["AXObject:", obj, "has broken ancestry. See qt bug 130116."]
debug.print_tokens(debug.LEVEL_INFO, tokens, True)
return True
return False
@staticmethod
def _can_reach_application(obj: Atspi.Accessible) -> bool:
"""Returns True if obj's ancestry reaches the application."""
reached_app = False
parent = AXObject.get_parent(obj)
while parent and not reached_app:
reached_app = AXObject.get_role(parent) == Atspi.Role.APPLICATION
parent = AXObject.get_parent(parent)
if not reached_app:
tokens = ["AXObject:", obj, "has broken ancestry. See qt bug 130116."]
return reached_app
@staticmethod
def has_broken_popup_ancestry(obj: Atspi.Accessible) -> bool:
"""Returns True if obj is a popup item whose ancestry is broken."""
if obj is None or AXObject.is_dead(obj):
return False
# Chromium Omnibox popups can lose their path back to the frame after
# the popup is closed and reopened.
if not AXObject.get_toolkit_name(obj).startswith("chromium"):
return False
if AXObject.get_role(obj) != Atspi.Role.LIST_ITEM:
return False
if not AXObject._can_reach_application(obj):
tokens = ["AXObject:", obj, "has broken popup ancestry."]
debug.print_tokens(debug.LEVEL_INFO, tokens, True)
return True
+7
View File
@@ -348,6 +348,13 @@ class FocusManager:
tokens.extend(["in", app])
_log_tokens(tokens)
if frame is None and AXObject.has_broken_popup_ancestry(self._focus):
_log_tokens(
["Not clearing active window; focus", self._focus, "is in popup with broken ancestry"],
"broken-popup-ancestry",
)
return
if frame == self._window:
_log("Setting active window to existing active window", "no-change")
elif frame is None: