From a7c786987d0bf112b4341a95c1365bbe8333e469 Mon Sep 17 00:00:00 2001 From: Cory LaViska Date: Thu, 14 Sep 2023 12:08:33 -0400 Subject: [PATCH] backport fix for 1548 --- docs/pages/resources/changelog.md | 1 + src/components/popup/popup.component.ts | 9 +++------ 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/docs/pages/resources/changelog.md b/docs/pages/resources/changelog.md index deb67d792..9f87be4f7 100644 --- a/docs/pages/resources/changelog.md +++ b/docs/pages/resources/changelog.md @@ -23,6 +23,7 @@ New versions of Web Awesome are released as-needed and generally occur when a cr - Fixed a bug in the autoloader causing it to register non-Shoelace elements [#1563] - Fixed a bug in `` that resulted in improper spacing between the label and the required asterisk [#1540] +- Removed error when a missing popup anchor is provided [#1548] - Updated `@ctrl/tinycolor` to 4.0.1 [#1542] - Updated Bootstrap Icons to 1.11.0 diff --git a/src/components/popup/popup.component.ts b/src/components/popup/popup.component.ts index e339215f2..d98a489f9 100644 --- a/src/components/popup/popup.component.ts +++ b/src/components/popup/popup.component.ts @@ -247,13 +247,10 @@ export default class WaPopup extends WebAwesomeElement { this.anchorEl = this.anchorEl.assignedElements({ flatten: true })[0] as HTMLElement; } - if (!this.anchorEl) { - throw new Error( - 'Invalid anchor element: no anchor could be found using the anchor slot or the anchor attribute.' - ); + // If the anchor is valid, start it up + if (this.anchorEl) { + this.start(); } - - this.start(); } private start() {