fix: more alignment
This commit is contained in:
@@ -183,6 +183,27 @@ document.addEventListener("DOMContentLoaded", () => {
|
||||
}
|
||||
};
|
||||
|
||||
this.menuIsOpen = () => {
|
||||
const titlebar = this.el.querySelector("[data-testid='window-titlebar']");
|
||||
return Boolean(titlebar?.dataset.openMenuGroup);
|
||||
};
|
||||
|
||||
this.handleTitlebarPointerDown = (event) => {
|
||||
if (!this.menuIsOpen()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (event.target.closest("[data-testid='window-titlebar-menu-button']")) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (event.target.closest("[data-testid='window-titlebar-menu-dropdown']")) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.pushEvent("close_titlebar_menu", {});
|
||||
};
|
||||
|
||||
this.handleChange = (event) => {
|
||||
const select = event.target.closest(".status-bar-language-select");
|
||||
|
||||
@@ -216,8 +237,16 @@ document.addEventListener("DOMContentLoaded", () => {
|
||||
});
|
||||
};
|
||||
|
||||
this.handleEscapeKey = (event) => {
|
||||
if (event.key === "Escape" && this.menuIsOpen()) {
|
||||
this.pushEvent("close_titlebar_menu", {});
|
||||
}
|
||||
};
|
||||
|
||||
window.addEventListener("bds:native-menu-action", this.handleNativeMenuAction);
|
||||
window.addEventListener("keydown", this.handleShortcutKeyDown, true);
|
||||
window.addEventListener("keydown", this.handleEscapeKey, true);
|
||||
window.addEventListener("pointerdown", this.handleTitlebarPointerDown, true);
|
||||
this.el.addEventListener("change", this.handleChange);
|
||||
},
|
||||
|
||||
@@ -226,6 +255,8 @@ document.addEventListener("DOMContentLoaded", () => {
|
||||
this.el.removeEventListener("change", this.handleChange);
|
||||
window.removeEventListener("bds:native-menu-action", this.handleNativeMenuAction);
|
||||
window.removeEventListener("keydown", this.handleShortcutKeyDown, true);
|
||||
window.removeEventListener("keydown", this.handleEscapeKey, true);
|
||||
window.removeEventListener("pointerdown", this.handleTitlebarPointerDown, true);
|
||||
if (this.destroyOverlaySync) {
|
||||
this.destroyOverlaySync();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user