From 3ad6364678ba26fb378ba59fad8b9b18556df331 Mon Sep 17 00:00:00 2001 From: Christian Schilling Date: Mon, 22 Apr 2024 17:40:54 +0200 Subject: [PATCH] Fixed a bug in that may throw errors on disconnectedCallback in test environments (#1985) (#1986) --- docs/pages/resources/changelog.md | 1 + src/components/textarea/textarea.component.ts | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/docs/pages/resources/changelog.md b/docs/pages/resources/changelog.md index c37c7ad7..ce82d41c 100644 --- a/docs/pages/resources/changelog.md +++ b/docs/pages/resources/changelog.md @@ -18,6 +18,7 @@ New versions of Shoelace are released as-needed and generally occur when a criti - Fixed a bug in `` where when it showed it would cause a layout shift. [#1967] - Fixed a bug in `` that allowed unwanted text properties to leak in [#1947] - Fixed a bug in `` classes [#1974] +- Fixed a bug in `` that may throw errors on `disconnectedCallback` in test environments [#1985] ## 2.15.0 diff --git a/src/components/textarea/textarea.component.ts b/src/components/textarea/textarea.component.ts index f4c6e0f4..d0dd8d5d 100644 --- a/src/components/textarea/textarea.component.ts +++ b/src/components/textarea/textarea.component.ts @@ -163,7 +163,9 @@ export default class SlTextarea extends ShoelaceElement implements ShoelaceFormC disconnectedCallback() { super.disconnectedCallback(); - this.resizeObserver.unobserve(this.input); + if (this.input) { + this.resizeObserver.unobserve(this.input); + } } private handleBlur() {