diff --git a/hassio/src/hassio-main.ts b/hassio/src/hassio-main.ts index e5b8f89530..102513139a 100644 --- a/hassio/src/hassio-main.ts +++ b/hassio/src/hassio-main.ts @@ -2,6 +2,8 @@ import { customElement, html, property, PropertyValues } from "lit-element"; import { atLeastVersion } from "../../src/common/config/version"; import { applyThemesOnElement } from "../../src/common/dom/apply_themes_on_element"; import { fireEvent } from "../../src/common/dom/fire_event"; +import { isNavigationClick } from "../../src/common/dom/is-navigation-click"; +import { navigate } from "../../src/common/navigate"; import { HassioPanelInfo } from "../../src/data/hassio/supervisor"; import { Supervisor } from "../../src/data/supervisor/supervisor"; import { makeDialogManager } from "../../src/dialogs/make-dialog-manager"; @@ -46,7 +48,7 @@ export class HassioMain extends SupervisorBaseElement { // listen on this element for navigation events, so we need to forward them. // Joakim - April 26, 2021 - // Due to changes in behavior in Google Chrome, we changed navigate to fire on the top element + // Due to changes in behavior in Google Chrome, we changed navigate to listen on the top element top.addEventListener("location-changed", (ev) => // @ts-ignore fireEvent(this, ev.type, ev.detail, { @@ -54,6 +56,15 @@ export class HassioMain extends SupervisorBaseElement { }) ); + // Paulus - May 17, 2021 + // Convert the tags to native nav in Home Assistant < 2021.6 + document.body.addEventListener("click", (ev) => { + const href = isNavigationClick(ev); + if (href) { + navigate(document.body, href); + } + }); + // Forward haptic events to parent window. window.addEventListener("haptic", (ev) => { // @ts-ignore