mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-13 12:26:35 +00:00
Make hassio backwards compat (#9195)
This commit is contained in:
parent
f8e8b5ad18
commit
5730c14dc1
@ -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 <a> 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
|
||||
|
Loading…
x
Reference in New Issue
Block a user