Bug 1956624 - Ensure sidebar collapses on mouse out when expand on hover is enabled and the window is inactive (macOS only) r=sidebar-reviewers,mstange,sclements
Differential Revision: https://phabricator.services.mozilla.com/D243512
This commit is contained in:
@@ -484,6 +484,7 @@ var gBrowserInit = {
|
||||
});
|
||||
|
||||
window.addEventListener("mousemove", MousePosTracker);
|
||||
window.addEventListener("mouseout", MousePosTracker);
|
||||
window.addEventListener("dragover", MousePosTracker);
|
||||
|
||||
gNavToolbox.addEventListener("customizationstarting", CustomizationHandler);
|
||||
|
||||
@@ -5064,6 +5064,10 @@ var MousePosTracker = {
|
||||
},
|
||||
|
||||
handleEvent(event) {
|
||||
if (event.type === "mouseout" && event.currentTarget !== window) {
|
||||
return;
|
||||
}
|
||||
|
||||
this._x = event.screenX - window.mozInnerScreenX;
|
||||
this._y = event.screenY - window.mozInnerScreenY;
|
||||
|
||||
|
||||
@@ -1963,29 +1963,9 @@ var SidebarController = {
|
||||
);
|
||||
},
|
||||
|
||||
handleEvent(e) {
|
||||
switch (e.type) {
|
||||
case "mouseout":
|
||||
if (
|
||||
(this._positionStart && e.x < 0) ||
|
||||
(!this._positionStart && e.x > window.outerWidth)
|
||||
) {
|
||||
this.mouseEnterTask?.disarm();
|
||||
// Only collapse sidebar if not moused over the window
|
||||
if (this.getUIState().launcherExpanded) {
|
||||
if (this._animationEnabled && !window.gReduceMotion) {
|
||||
this._animateSidebarMain();
|
||||
}
|
||||
this._state.launcherExpanded = false;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
},
|
||||
|
||||
getMouseTargetRect() {
|
||||
let launcherRect = window.windowUtils.getBoundsWithoutFlushing(
|
||||
SidebarController.sidebarContainer
|
||||
SidebarController.sidebarMain
|
||||
);
|
||||
return {
|
||||
top: launcherRect.top,
|
||||
@@ -2013,13 +1993,11 @@ var SidebarController = {
|
||||
}
|
||||
await this.waitUntilStable();
|
||||
MousePosTracker.addListener(this);
|
||||
window.addEventListener("mouseout", this);
|
||||
if (!isDragEnded) {
|
||||
await this.setLauncherCollapsedWidth();
|
||||
}
|
||||
} else {
|
||||
MousePosTracker.removeListener(this);
|
||||
window.removeEventListener("mouseout", this);
|
||||
if (!this.mouseOverTask?.isFinalized) {
|
||||
this.mouseOverTask?.finalize();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user