Monkey patch for bug in safari 14 (#7031)

This commit is contained in:
Bram Kragten 2020-09-17 10:49:37 +02:00 committed by GitHub
parent 854a54e9c6
commit b7d7ca4014
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 20 additions and 0 deletions

View File

@ -1,3 +1,4 @@
import "../../../src/resources/safari-14-attachshadow-patch";
import "../../../src/resources/ha-style";
import "../../../src/resources/roboto";
import "./layout/hc-connect";

View File

@ -1,3 +1,4 @@
import "../../src/resources/safari-14-attachshadow-patch";
import "@polymer/polymer/lib/elements/dom-if";
import "@polymer/polymer/lib/elements/dom-repeat";
import "../../src/resources/ha-style";

View File

@ -1,4 +1,5 @@
import "../../src/resources/compatibility";
import "../../src/resources/safari-14-attachshadow-patch";
import "../../src/resources/roboto";
import "./hassio-main";

View File

@ -1,5 +1,6 @@
// Compat needs to be first import
import "../resources/compatibility";
import "../resources/safari-14-attachshadow-patch";
import "@polymer/polymer/lib/elements/dom-if";
import "@polymer/polymer/lib/elements/dom-repeat";
import "../auth/ha-authorize";

View File

@ -1,5 +1,6 @@
// Compat needs to be first import
import "../resources/compatibility";
import "../resources/safari-14-attachshadow-patch";
import {
Auth,
Connection,

View File

@ -1,4 +1,5 @@
import "../resources/compatibility";
import "../resources/safari-14-attachshadow-patch";
import { PolymerElement } from "@polymer/polymer";
import { fireEvent } from "../common/dom/fire_event";
import { loadJS } from "../common/dom/load_resource";

View File

@ -1,5 +1,6 @@
// Compat needs to be first import
import "../resources/compatibility";
import "../resources/safari-14-attachshadow-patch";
import "../onboarding/ha-onboarding";
import "../resources/ha-style";
import "../resources/roboto";

View File

@ -0,0 +1,13 @@
// https://github.com/home-assistant/frontend/pull/7031
const isSafari14 = /^((?!chrome|android).)*version\/14\.0.*safari/i.test(
navigator.userAgent
);
if (isSafari14) {
const origAttachShadow = window.Element.prototype.attachShadow;
window.Element.prototype.attachShadow = function (init) {
if (init && init.delegatesFocus) {
delete init.delegatesFocus;
}
return origAttachShadow.apply(this, [init]);
};
}