summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortoofar <toofar@spalge.com>2023-03-19 13:11:12 +1300
committertoofar <toofar@spalge.com>2023-03-19 13:23:18 +1300
commit294e73660c1f3d1aff50843c25e2f8f7574c4332 (patch)
tree2c6ba6b8e12f6adc2f62f309524d57f1832d35dc
parentcb9f3fa141dac990c69973ae3aef8b175938c2eb (diff)
downloadqutebrowser-294e73660c1f3d1aff50843c25e2f8f7574c4332.tar.gz
qutebrowser-294e73660c1f3d1aff50843c25e2f8f7574c4332.zip
Re-focus tabs created from :undo
There's some weird issue with Qt6.4 and 6.5 where a webengine view gets its widget swapped out when it gets history deserialized into it. While it's swapping widgets it has no so the focus gets passed to some other widget should never even have focus. There's probably more comprehensive ways we could handle this, by overriding the WebEngineView layout, or by overriding focusNextPrevChild on the parent to put out own logic into the "child is going, pass focus to parent" logic chain. But all that seems like a bit too much of a headache for this very focussed issue. We want the new tab to get focus, so lets re-focus it. Technically we could just focus the last tab that we open, if we are undoing multiple, but the existing logic is to open each of them in turn as foreground tabs and this reinforces that. Closes: #7623
-rw-r--r--qutebrowser/mainwindow/tabbedbrowser.py1
-rw-r--r--tests/end2end/features/hints.feature10
2 files changed, 11 insertions, 0 deletions
diff --git a/qutebrowser/mainwindow/tabbedbrowser.py b/qutebrowser/mainwindow/tabbedbrowser.py
index ca6409ba0..770e6a039 100644
--- a/qutebrowser/mainwindow/tabbedbrowser.py
+++ b/qutebrowser/mainwindow/tabbedbrowser.py
@@ -564,6 +564,7 @@ class TabbedBrowser(QWidget):
newtab.history.private_api.deserialize(entry.history)
newtab.set_pinned(entry.pinned)
+ newtab.setFocus()
@pyqtSlot('QUrl', bool)
def load_url(self, url, newtab):
diff --git a/tests/end2end/features/hints.feature b/tests/end2end/features/hints.feature
index 47153b741..d6f48a87c 100644
--- a/tests/end2end/features/hints.feature
+++ b/tests/end2end/features/hints.feature
@@ -620,3 +620,13 @@ Feature: Using hints
# Changing tabs will leave hint mode
And I wait until qute://pyeval/ is loaded
Then the page should contain the plaintext "'Follow hint...'"
+
+ Scenario: Hinting an input after undoing a tab close
+ When I open about:blank
+ And I open data/hints/link_input.html in a new tab
+ And I run :tab-close
+ And I run :undo
+ And I wait until data/hints/link_input.html is loaded
+ And I run :click-element id qute-input-existing
+ And I run :fake-key -g something
+ Then the javascript message "contents: existingsomething" should be logged