Fix hassio panel nav on <0.90 HA

This commit is contained in:
Paulus Schoutsen 2019-03-19 10:10:26 -07:00
parent 1d1c981601
commit 03dffa9905

View File

@ -10,6 +10,7 @@ import "./hassio-pages-with-tabs";
import applyThemesOnElement from "../../src/common/dom/apply_themes_on_element"; import applyThemesOnElement from "../../src/common/dom/apply_themes_on_element";
import EventsMixin from "../../src/mixins/events-mixin"; import EventsMixin from "../../src/mixins/events-mixin";
import NavigateMixin from "../../src/mixins/navigate-mixin"; import NavigateMixin from "../../src/mixins/navigate-mixin";
import { fireEvent } from "../../src/common/dom/fire_event";
class HassioMain extends EventsMixin(NavigateMixin(PolymerElement)) { class HassioMain extends EventsMixin(NavigateMixin(PolymerElement)) {
static get template() { static get template() {
@ -90,6 +91,15 @@ class HassioMain extends EventsMixin(NavigateMixin(PolymerElement)) {
this.hass.dockedSidebar ? "hass-close-menu" : "hass-open-menu" this.hass.dockedSidebar ? "hass-close-menu" : "hass-open-menu"
); );
}); });
// Paulus - March 19, 2019
// We changed the navigate event to fire directly on the window, as that's
// where we are listening for it. However, the older panel_custom will
// listen on this element for navigation events, so we need to forward them.
window.addEventListener("location-changed", (ev) =>
fireEvent(this, ev.type, ev.detail, {
bubbles: false,
})
);
} }
connectedCallback() { connectedCallback() {