From 737b55d78dd8af6294e9bb54d80c8f86c0052cff Mon Sep 17 00:00:00 2001 From: Christophe Eymard Date: Fri, 10 Feb 2023 21:56:57 +0100 Subject: [PATCH] allow Element as the anchor - now with correct typings --- src/components/popup/popup.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/popup/popup.ts b/src/components/popup/popup.ts index 0edecc332..c9e7f4f49 100644 --- a/src/components/popup/popup.ts +++ b/src/components/popup/popup.ts @@ -38,7 +38,7 @@ import type { CSSResultGroup } from 'lit'; export default class SlPopup extends ShoelaceElement { static styles: CSSResultGroup = styles; - private anchorEl: HTMLElement | null; + private anchorEl: Element | null; private cleanup: ReturnType | undefined; /** A reference to the internal popup container. Useful for animating and styling the popup with JavaScript. */ @@ -223,7 +223,7 @@ export default class SlPopup extends ShoelaceElement { // Locate the anchor by id const root = this.getRootNode() as Document | ShadowRoot; this.anchorEl = root.getElementById(this.anchor); - } else if (this.anchor instanceof HTMLElement) { + } else if (this.anchor instanceof Element) { // Use the anchor's reference this.anchorEl = this.anchor; } else {