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:
Kelly Cochrane
2025-04-02 14:44:08 +00:00
parent fc71162063
commit a75d2e147f
3 changed files with 6 additions and 23 deletions

View File

@@ -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();
}