From 2b67f4babeb48fcb24343ddd2940a67db236ab6d Mon Sep 17 00:00:00 2001 From: Marco D'Auria <101181211+dauriamarco@users.noreply.github.com> Date: Tue, 28 Nov 2023 12:45:56 +0100 Subject: [PATCH] fix(sbb-selection-panel): fix data-state on selection panels with no content (#2236) --- src/components/selection-panel/selection-panel.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/components/selection-panel/selection-panel.ts b/src/components/selection-panel/selection-panel.ts index 7da4885be0..e13b9db8bc 100644 --- a/src/components/selection-panel/selection-panel.ts +++ b/src/components/selection-panel/selection-panel.ts @@ -121,7 +121,7 @@ export class SbbSelectionPanel extends LitElement { this._checked = event.detail.checked; - if (this.forceOpen) { + if (!this._namedSlots['content'] || this.forceOpen) { return; } @@ -161,7 +161,8 @@ export class SbbSelectionPanel extends LitElement { private _updateSelectionPanel(): void { this._checked = this._input?.checked; - this._state = this._checked || this.forceOpen ? 'opened' : 'closed'; + this._state = + this._checked || this.forceOpen || !this._namedSlots['content'] ? 'opened' : 'closed'; this._disabled = this._input?.disabled; }