Open links in current tab
Fix for #676 It removes the target of the link, as to prevent the website to overrule the user. I guess the following things should be done: - add setting to enable/disable this behaviour - and/or add "hint all current" Only the first one would be easiest. The second one requires us to keep track of the original target. I should open a pull request for discussion.
This commit is contained in:
parent
bec8bd0285
commit
76935291c0
@ -463,6 +463,7 @@ class HintManager(QObject):
|
|||||||
QMouseEvent(QEvent.MouseButtonRelease, pos, Qt.LeftButton,
|
QMouseEvent(QEvent.MouseButtonRelease, pos, Qt.LeftButton,
|
||||||
Qt.NoButton, modifiers),
|
Qt.NoButton, modifiers),
|
||||||
]
|
]
|
||||||
|
elem.remove_target()
|
||||||
for evt in events:
|
for evt in events:
|
||||||
self.mouse_event.emit(evt)
|
self.mouse_event.emit(evt)
|
||||||
if elem.is_text_input() and elem.is_editable():
|
if elem.is_text_input() and elem.is_editable():
|
||||||
|
@ -285,6 +285,13 @@ class WebElementWrapper(collections.abc.MutableMapping):
|
|||||||
tag = self._elem.tagName().lower()
|
tag = self._elem.tagName().lower()
|
||||||
return self.get('role', None) in roles or tag in ('input', 'textarea')
|
return self.get('role', None) in roles or tag in ('input', 'textarea')
|
||||||
|
|
||||||
|
def remove_target(self):
|
||||||
|
"""Remove target from link"""
|
||||||
|
if self._elem.tagName().lower() == 'a':
|
||||||
|
self._elem.removeAttribute('target')
|
||||||
|
elif self.parent().tagName().lower() == 'a':
|
||||||
|
self.parent().removeAttribute('target')
|
||||||
|
|
||||||
def debug_text(self):
|
def debug_text(self):
|
||||||
"""Get a text based on an element suitable for debug output."""
|
"""Get a text based on an element suitable for debug output."""
|
||||||
self._check_vanished()
|
self._check_vanished()
|
||||||
|
Loading…
Reference in New Issue
Block a user