This commit is contained in:
youve 2026-01-07 16:40:46 -08:00 committed by GitHub
commit 918ab6c684
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 10 additions and 0 deletions

View File

@ -229,6 +229,12 @@ class HintActions:
try:
if context.target == Target.hover:
elem.hover()
elem_info = elem.info_str()
if elem_info:
elem_info = elem_info.strip()
if elem_info:
# Don't display an empty message
message.info(elem_info)
elif context.target == Target.right_click:
elem.right_click()
elif context.target == Target.current:

View File

@ -445,6 +445,10 @@ class AbstractWebElement(collections.abc.MutableMapping): # type: ignore[type-a
Qt.KeyboardModifier.NoModifier)
self._tab.send_event(event)
def info_str(self) -> Optional[str]:
"""Return the contents of the element's title or alt tag for display."""
return self.get("title") or self.get("alt") or None
def right_click(self) -> None:
"""Simulate a right-click on the element."""
self._click_fake_event(usertypes.ClickTarget.normal,