mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-28 19:56:42 +00:00
Close the drawer when picking a panel when in forced narrow mode (#3402)
This commit is contained in:
parent
2fd75742f1
commit
56c08a1d07
@ -44,8 +44,7 @@ class HomeAssistantMain extends LitElement {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const sidebarNarrow =
|
const sidebarNarrow = this._sidebarNarrow;
|
||||||
this.narrow || this.hass.dockedSidebar === "always_hidden";
|
|
||||||
|
|
||||||
const disableSwipe =
|
const disableSwipe =
|
||||||
!sidebarNarrow || NON_SWIPABLE_PANELS.indexOf(hass.panelUrl) !== -1;
|
!sidebarNarrow || NON_SWIPABLE_PANELS.indexOf(hass.panelUrl) !== -1;
|
||||||
@ -91,7 +90,7 @@ class HomeAssistantMain extends LitElement {
|
|||||||
import(/* webpackChunkName: "ha-sidebar" */ "../components/ha-sidebar");
|
import(/* webpackChunkName: "ha-sidebar" */ "../components/ha-sidebar");
|
||||||
|
|
||||||
this.addEventListener("hass-toggle-menu", () => {
|
this.addEventListener("hass-toggle-menu", () => {
|
||||||
if (this.narrow || this.hass.dockedSidebar === "always_hidden") {
|
if (this._sidebarNarrow) {
|
||||||
if (this.drawer.opened) {
|
if (this.drawer.opened) {
|
||||||
this.drawer.close();
|
this.drawer.close();
|
||||||
} else {
|
} else {
|
||||||
@ -120,7 +119,7 @@ class HomeAssistantMain extends LitElement {
|
|||||||
this.narrow || this.hass.dockedSidebar !== "auto"
|
this.narrow || this.hass.dockedSidebar !== "auto"
|
||||||
);
|
);
|
||||||
|
|
||||||
if (changedProps.has("route") && this.narrow) {
|
if (changedProps.has("route") && this._sidebarNarrow) {
|
||||||
this.drawer.close();
|
this.drawer.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -136,6 +135,10 @@ class HomeAssistantMain extends LitElement {
|
|||||||
this.narrow = ev.detail.value;
|
this.narrow = ev.detail.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private get _sidebarNarrow() {
|
||||||
|
return this.narrow || this.hass.dockedSidebar === "always_hidden";
|
||||||
|
}
|
||||||
|
|
||||||
private get drawer(): AppDrawerElement {
|
private get drawer(): AppDrawerElement {
|
||||||
return this.shadowRoot!.querySelector("app-drawer")!;
|
return this.shadowRoot!.querySelector("app-drawer")!;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user