Refocus webview after spawning a background tab

This commit is contained in:
Jay Kamat 2018-05-10 09:34:38 -07:00
parent 538b4fafdb
commit 95093b82c9
No known key found for this signature in database
GPG Key ID: 5D2E399600F4F7B5
3 changed files with 24 additions and 11 deletions

View File

@ -487,6 +487,8 @@ class TabbedBrowser(QWidget):
tab.resize(self.widget.currentWidget().size())
self.widget.tab_index_changed.emit(self.widget.currentIndex(),
self.widget.count())
# Refocus webview in case we lost it by spawning a bg tab
self.widget.currentWidget().setFocus()
else:
self.widget.setCurrentWidget(tab)
# WORKAROUND for https://bugreports.qt.io/browse/QTBUG-68076

View File

@ -203,17 +203,6 @@ Feature: Using hints
And I run :fake-key new
Then the javascript message "contents: existingnew" should be logged
Scenario: Typing input with existing text after opening a bg tab
When I open data/hints/link_input.html
And I run :click-element id qute-input-existing
And I wait for "Entering mode KeyMode.insert *" in the log
And I run :leave-mode
And I hint with args "all tab-bg" and follow a
And I wait until data/hello.txt is loaded
And I run :enter-mode insert
And I run :fake-key -g new
Then the javascript message "contents: existingnew" should be logged
### iframes
Scenario: Using :follow-hint inside an iframe
When I open data/hints/iframe.html

View File

@ -1250,3 +1250,25 @@ Feature: Tab management
Then the following tabs should be open:
- data/numbers/1.txt
- data/numbers/2.txt (pinned) (active)
Scenario: Focused webview after clicking link in bg
When I open data/hints/link_input.html
And I run :click-element id qute-input-existing
And I wait for "Entering mode KeyMode.insert *" in the log
And I run :leave-mode
And I hint with args "all tab-bg" and follow a
And I wait until data/hello.txt is loaded
And I run :enter-mode insert
And I run :fake-key -g new
Then the javascript message "contents: existingnew" should be logged
Scenario: Focused webview after opening link in bg
When I open data/hints/link_input.html
And I run :click-element id qute-input-existing
And I wait for "Entering mode KeyMode.insert *" in the log
And I run :leave-mode
And I open data/hello.txt in a new background tab
And I run :enter-mode insert
And I run :fake-key -g new
Then the javascript message "contents: existingnew" should be logged