diff --git a/src/components/checkbox/checkbox/checkbox.ts b/src/components/checkbox/checkbox/checkbox.ts index 822dde7758f..17cec91fd03 100644 --- a/src/components/checkbox/checkbox/checkbox.ts +++ b/src/components/checkbox/checkbox/checkbox.ts @@ -111,7 +111,13 @@ export class SbbCheckboxElement extends UpdateScheduler(LitElement) { } private _size: SbbCheckboxSize = 'm'; - /** Whether the input is the main input of a selection panel. */ + /** + * Whether the input is the main input of a selection panel. + * @internal + */ + public get isSelectionPanelInput(): boolean { + return this._isSelectionPanelInput; + } @state() private _isSelectionPanelInput = false; /** The label describing whether the selection panel is expanded (for screen readers only). */ diff --git a/src/components/radio-button/radio-button/radio-button.ts b/src/components/radio-button/radio-button/radio-button.ts index d9d2dedd235..3d99f5da8ed 100644 --- a/src/components/radio-button/radio-button/radio-button.ts +++ b/src/components/radio-button/radio-button/radio-button.ts @@ -115,7 +115,11 @@ export class SbbRadioButtonElement extends UpdateScheduler(LitElement) { /** * Whether the input is the main input of a selection panel. + * @internal */ + public get isSelectionPanelInput(): boolean { + return this._isSelectionPanelInput; + } @state() private _isSelectionPanelInput = false; /** @@ -150,6 +154,7 @@ export class SbbRadioButtonElement extends UpdateScheduler(LitElement) { private _handleCheckedChange(currentValue: boolean, previousValue: boolean): void { if (currentValue !== previousValue) { + console.log('checked change'); this._stateChange.emit({ type: 'checked', checked: currentValue }); this._isSelectionPanelInput && this._updateExpandedLabel(); } diff --git a/src/components/selection-panel/selection-panel.ts b/src/components/selection-panel/selection-panel.ts index a9ba2da6120..00963b3e725 100644 --- a/src/components/selection-panel/selection-panel.ts +++ b/src/components/selection-panel/selection-panel.ts @@ -146,6 +146,11 @@ export class SbbSelectionPanelElement extends LitElement { private _initFromInput(event: Event): void { const input = event.target as SbbCheckboxElement | SbbRadioButtonElement; + + if (!input.isSelectionPanelInput) { + return; + } + this._checked = input.checked; this._disabled = input.disabled; this._updateState(); @@ -154,6 +159,12 @@ export class SbbSelectionPanelElement extends LitElement { private _onInputStateChange( event: CustomEvent, ): void { + const input = event.target as SbbCheckboxElement | SbbRadioButtonElement; + + if (!input.isSelectionPanelInput) { + return; + } + if (event.detail.type === 'disabled') { this._disabled = event.detail.disabled; return; @@ -191,7 +202,7 @@ export class SbbSelectionPanelElement extends LitElement {
this._onAnimationEnd(event)} >