Skip to content

Commit

Permalink
fixed appselector conext menu bug
Browse files Browse the repository at this point in the history
  • Loading branch information
mjishnu committed Nov 19, 2023
1 parent cabab63 commit a568fd9
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions app/modules/app_selector.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,18 @@ def contextMenuEvent(self, event):
self._context_menu_pos = event.pos()

# Check if the element under the cursor is a text box using JavaScript
script = """
x = event.x()
y = event.y()

script = f"""
(function() {{
let el = document.elementFromPoint({}, {});
let el = document.elementFromPoint({x}, {y});
while (el && el.shadowRoot) {{
el = el.shadowRoot.elementFromPoint({x}, {y});
}}
return el && (el.tagName === 'INPUT' || el.tagName === 'TEXTAREA' || el.isContentEditable);
}})()
""".format(event.x(), event.y())
"""
self.page().runJavaScript(script, self._on_text_box_check)

def _on_text_box_check(self, is_text_box):
Expand Down

0 comments on commit a568fd9

Please sign in to comment.