Skip to content

Commit

Permalink
brave#323 - differentiate between external and internal navigation wh…
Browse files Browse the repository at this point in the history
…en hiding findbar.

The code was moved from findbar.js to frame.js, as it is more logic for the frame to decide who closes him
I wanted originally use will-navigate as it is better to close the find dialog beforehands, but for some reason the event did not fire when using   this.webview.addEventListener('will-navigate'
So i used did-navigate. This means that the search box will be closed after the user navigated.
  • Loading branch information
david-gang committed Jul 26, 2016
1 parent 611f617 commit e4e9613
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 0 additions & 3 deletions js/components/findbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,6 @@ class FindBar extends ImmutableComponent {
// Redo search if details have changed
this.onFindFirst()
}
if (this.props.frame.get('location') !== prevProps.frame.get('location')) {
this.props.onFindHide()
}
}

onKeyDown (e) {
Expand Down
4 changes: 4 additions & 0 deletions js/components/frame.js
Original file line number Diff line number Diff line change
Expand Up @@ -678,7 +678,11 @@ class Frame extends ImmutableComponent {
// XXX: loadstart probably does not need to be called twice anymore.
loadStart(e)
})

this.webview.addEventListener('did-navigate', (e) => {
if (this.props.frame.get('findbarShown')) {
this.onFindHide()
}
for (let message in this.notificationCallbacks) {
appActions.hideMessageBox(message)
}
Expand Down

0 comments on commit e4e9613

Please sign in to comment.