Skip to content
This repository has been archived by the owner on Dec 11, 2019. It is now read-only.

Commit

Permalink
Improve tab preview timing
Browse files Browse the repository at this point in the history
- Fix #8860
- Auditors: @bsclifton, @bradleyrichter
  • Loading branch information
cezaraugusto committed May 17, 2017
1 parent 6ec02d8 commit 1154bb3
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions app/renderer/components/tabs/tab.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,16 +172,17 @@ class Tab extends ImmutableComponent {
}

onMouseEnter (e) {
// relatedTarget inside mouseenter checks which element before this event was the pointer on
// if this element has a tab-like class, then it's likely that the user was previewing
// a sequency of tabs. Called here as previewMode.
const previewMode = /tab(?!pages)/i.test(e.relatedTarget.classList)
// Includes all classes that the mouse can came from
// if user is going from urlbar to webview or vice-versa
const fromVerticalAxis =
/^tab(?=stoolbar|pages)|^allowdragging|^singlepage|^bookmarks|^webview/i
.test(e.relatedTarget.classList)

// If user isn't in previewMode, we add a bit of delay to avoid tab from flashing out
// as reported here: https://github.com/brave/browser-laptop/issues/1434
if (this.props.previewTabs) {
this.hoverTimeout =
window.setTimeout(windowActions.setPreviewFrame.bind(null, this.props.frame.get('key')), previewMode ? 0 : 200)
this.hoverTimeout = window.setTimeout(
windowActions.setPreviewFrame.bind(null, this.props.frame.get('key')),
fromVerticalAxis ? 350 : 0
)
}
windowActions.setTabHoverState(this.props.frame.get('key'), true)
}
Expand Down

0 comments on commit 1154bb3

Please sign in to comment.