Skip to content

Commit 0ea601a

Browse files
committed
Fix minor find in page bugs
Fixes #2368
1 parent fbab15a commit 0ea601a

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

js/findinpage.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,9 @@ findinpage.endButton.addEventListener('click', function () {
6464
findinpage.input.addEventListener('input', function (e) {
6565
if (this.value) {
6666
webviews.callAsync(findinpage.activeTab, 'findInPage', findinpage.input.value)
67+
} else {
68+
webviews.callAsync(findinpage.activeTab, 'stopFindInPage', 'clearSelection')
69+
findinpage.counter.textContent = ''
6770
}
6871
})
6972

@@ -98,8 +101,14 @@ webviews.bindEvent('view-hidden', function (tabId) {
98101
}
99102
})
100103

104+
tasks.on('tab-selected', function (tabId) {
105+
if (tabId !== findinpage.activeTab) {
106+
findinpage.end()
107+
}
108+
})
109+
101110
webviews.bindEvent('did-start-navigation', function (tabId, url, isInPlace, isMainFrame, frameProcessId, frameRoutingId) {
102-
if (!isInPlace && tabId === findinpage.activeTab) {
111+
if (isMainFrame && !isInPlace && tabId === findinpage.activeTab) {
103112
findinpage.end()
104113
}
105114
})

0 commit comments

Comments
 (0)