diff --git a/browser/base/content/browser-places.js b/browser/base/content/browser-places.js index 680b129fb9ad..02ccdf2b6340 100644 --- a/browser/base/content/browser-places.js +++ b/browser/base/content/browser-places.js @@ -25,7 +25,7 @@ var StarUI = { element.hidden = false; element.addEventListener("keypress", this, false); element.addEventListener("mouseout", this, false); - element.addEventListener("mouseover", this, false); + element.addEventListener("mousemove", this, false); element.addEventListener("popuphidden", this, false); element.addEventListener("popupshown", this, false); return this.panel = element; @@ -63,7 +63,7 @@ var StarUI = { // nsIDOMEventListener handleEvent(aEvent) { switch (aEvent.type) { - case "mouseover": + case "mousemove": clearTimeout(this._autoCloseTimer); break; case "popuphidden": @@ -138,6 +138,9 @@ var StarUI = { // Explicit fall-through } case "popupshown": + if (aEvent.target != aEvent.currentTarget) { + break; + } // auto-close if new and not interacted with if (this._isNewBookmark) { // 3500ms matches the timeout that Pocket uses in @@ -146,7 +149,9 @@ var StarUI = { if (this._closePanelQuickForTesting) { delay /= 10; } - this._autoCloseTimer = setTimeout(() => this.panel.hidePopup(), delay, this); + this._autoCloseTimer = setTimeout(() => { + this.panel.hidePopup(); + }, delay); } break; } diff --git a/browser/base/content/test/general/browser_bookmark_popup.js b/browser/base/content/test/general/browser_bookmark_popup.js index fa25d949da77..b8e19e263d56 100644 --- a/browser/base/content/test/general/browser_bookmark_popup.js +++ b/browser/base/content/test/general/browser_bookmark_popup.js @@ -122,28 +122,28 @@ add_task(function* panel_shown_for_keyboardshortcut_on_new_bookmark_star_and_aut }); }); -add_task(function* panel_shown_for_new_bookmarks_mouseover_mouseout() { +add_task(function* panel_shown_for_new_bookmarks_mousemove_mouseout() { yield test_bookmarks_popup({ isNewBookmark: true, popupShowFn() { bookmarkStar.click(); }, *popupEditFn() { - let mouseOverPromise = new Promise(resolve => { - bookmarkPanel.addEventListener("mouseover", function onmouseover() { - bookmarkPanel.removeEventListener("mouseover", onmouseover); + let mouseMovePromise = new Promise(resolve => { + bookmarkPanel.addEventListener("mousemove", function onmousemove() { + bookmarkPanel.removeEventListener("mousemove", onmousemove); resolve(); }); }); yield new Promise(resolve => { EventUtils.synthesizeNativeMouseMove(bookmarkPanel, 0, 0, resolve, window); }); - info("Waiting for mouseover event"); - yield mouseOverPromise; - info("Got mouseover event"); + info("Waiting for mousemove event"); + yield mouseMovePromise; + info("Got mousemove event"); yield new Promise(resolve => setTimeout(resolve, 400)); - is(bookmarkPanel.state, "open", "Panel should still be open on mouseover"); + is(bookmarkPanel.state, "open", "Panel should still be open on mousemove"); }, *popupHideFn() { let mouseOutPromise = new Promise(resolve => {