tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit 7a33acafd0e7437842122f26e35f9823e87ca747
parent a4c738e438a6eb5f01533846eeb2f0b150c9d14d
Author: Aaron Kriegman <aaronkplus2@gmail.com>
Date:   Tue, 18 Nov 2025 16:09:14 +0000

Bug 1955625 - Ignore synthetic mouse events in ctrlTab panel. r=dao,tabbrowser-reviewers

Differential Revision: https://phabricator.services.mozilla.com/D272978

Diffstat:
Mbrowser/components/tabbrowser/content/browser-ctrlTab.js | 25+++++--------------------
1 file changed, 5 insertions(+), 20 deletions(-)

diff --git a/browser/components/tabbrowser/content/browser-ctrlTab.js b/browser/components/tabbrowser/content/browser-ctrlTab.js @@ -428,12 +428,6 @@ var ctrlTab = { } }, - _mouseOverFocus: function ctrlTab_mouseOverFocus(aPreview) { - if (this._trackMouseOver) { - aPreview.focus(); - } - }, - pick: function ctrlTab_pick(aPreview) { if (!this.tabCount) { return; @@ -496,7 +490,6 @@ var ctrlTab = { ); this.canvasHeight = Math.round(this.canvasWidth * tabPreviews.aspectRatio); this.updatePreviews(); - this._trackMouseOver = false; this._selectedIndex = 1; gBrowser.warmupTab(this.selected._tab); @@ -546,18 +539,6 @@ var ctrlTab = { setupGUI: function ctrlTab_setupGUI() { this.selected.focus(); this._selectedIndex = -1; - - // Wait for two animation frames before tracking mouse movement as we might - // get a synthetic mousemove event when a Ctrl-Tab item happens to be under - // the mouse pointer initially as the panel opens, which we don't want to - // interpret as the user selecting that item. - requestAnimationFrame(() => { - requestAnimationFrame(() => { - if (this.isOpen) { - this._trackMouseOver = true; - } - }); - }); }, suspendGUI: function ctrlTab_suspendGUI() { @@ -725,7 +706,11 @@ var ctrlTab = { } break; case "mouseover": - this._mouseOverFocus(event.currentTarget); + // relatedTarget is the element the mouse came from. It is null when we + // get a synthetic mouse event. + if (event.relatedTarget) { + event.currentTarget.focus(); + } break; case "command": this.pick(event.currentTarget);