From ba21fb378469836734e4abe2674ead9da03dba14 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Fri, 17 Feb 2017 06:57:31 +0100 Subject: [PATCH] webengine: Use _click_href for hinting target=_blank links Fixes #2311 --- qutebrowser/browser/webelem.py | 7 ++++++- tests/end2end/features/hints.feature | 1 - 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/qutebrowser/browser/webelem.py b/qutebrowser/browser/webelem.py index 02521f3a4..85594ce43 100644 --- a/qutebrowser/browser/webelem.py +++ b/qutebrowser/browser/webelem.py @@ -403,7 +403,12 @@ class AbstractWebElement(collections.abc.MutableMapping): href_tags = ['a', 'area', 'link'] if click_target == usertypes.ClickTarget.normal: - if self.tag_name() in href_tags and self.get('target') != '_blank': + if self.tag_name() in href_tags and self.get('target') == '_blank': + log.webelem.debug("target _blank -> Clicking via href") + # FIXME:qtwebengine Should we use tab_bg here with + # background-tabs set? + self._click_href(usertypes.ClickTarget.tab) + elif self.tag_name() in href_tags: log.webelem.debug("Clicking via JS click()") self._click_js(click_target) elif self.is_editable(strict=True): diff --git a/tests/end2end/features/hints.feature b/tests/end2end/features/hints.feature index 5425cecb6..bb81bc7cb 100644 --- a/tests/end2end/features/hints.feature +++ b/tests/end2end/features/hints.feature @@ -18,7 +18,6 @@ Feature: Using hints Then the following tabs should be open: - data/hello.txt (active) - @qtwebengine_skip: Opens in background Scenario: Following a hint and allow to open in new tab. When I open data/hints/link_blank.html And I hint with args "links normal" and follow a