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:
co-authored by
Hariom Balhara
parent
ea73870ce9
commit
235ec0e906
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user