improve typing by removing as html element (#7212)

* refactor(embeds): use generic HTMLIFrameElement instead of 'as HTMLIFrameElement'

* refactor(embeds): improve types for floatingButton logic

* Fix floating button popup not working

---------

Co-authored-by: Hariom Balhara <hariombalhara@gmail.com>
This commit is contained in:
Oscar Dominguez
2023-02-20 17:37:03 +00:00
committed by GitHub
co-authored by Hariom Balhara
parent ea73870ce9
commit 235ec0e906
7 changed files with 46 additions and 34 deletions
@@ -76,7 +76,7 @@ export class ModalBox extends HTMLElement {
connectedCallback() {
this.assertHasShadowRoot();
const closeEl = this.shadowRoot.querySelector(".close") as HTMLElement;
const closeEl = this.shadowRoot.querySelector<HTMLElement>(".close");
document.addEventListener(
"keydown",
(e) => {
@@ -92,9 +92,11 @@ export class ModalBox extends HTMLElement {
this.close();
});
closeEl.onclick = () => {
this.close();
};
if (closeEl) {
closeEl.onclick = () => {
this.close();
};
}
}
constructor() {