diff --git a/.changeset/silent-cameras-invent.md b/.changeset/silent-cameras-invent.md new file mode 100644 index 0000000000..30b2622eaf --- /dev/null +++ b/.changeset/silent-cameras-invent.md @@ -0,0 +1,5 @@ +--- +'@baloise/ds-core': patch +--- + +**radio**: radio can not be unselected diff --git a/e2e/cypress/e2e/base/bal-radio.cy.ts b/e2e/cypress/e2e/base/bal-radio.cy.ts index 4f32657ed3..4fa1cb3df5 100644 --- a/e2e/cypress/e2e/base/bal-radio.cy.ts +++ b/e2e/cypress/e2e/base/bal-radio.cy.ts @@ -4,8 +4,8 @@ describe('bal-radio', () => { cy.waitForDesignSystem() }) - it.only('should select the 1st radio', () => { - cy.getByTestId('basic').find('bal-radio').first().should('be.checked').check().should('not.be.checked') + it('should select the 1st radio', () => { + cy.getByTestId('basic').find('bal-radio').first().should('be.checked').check().should('be.checked') cy.getByTestId('basic').find('bal-radio').eq(1).should('not.be.checked') cy.getByTestId('basic').find('bal-radio').eq(2).should('not.be.checked') cy.getByTestId('basic').find('bal-radio').eq(3).should('not.be.checked') diff --git a/packages/core/src/components/bal-radio/bal-radio.tsx b/packages/core/src/components/bal-radio/bal-radio.tsx index 2ec310454a..2497d43183 100644 --- a/packages/core/src/components/bal-radio/bal-radio.tsx +++ b/packages/core/src/components/bal-radio/bal-radio.tsx @@ -311,14 +311,6 @@ export class Radio implements ComponentInterface, BalElementStateInfo, Loggable, this.checked = newChecked } } - - // if (this.radioButton) { - // this.buttonTabindex = -1 - - // if (this.radioButton.setChecked) { - // this.radioButton.setChecked(this.checked) - // } - // } } /** @@ -384,7 +376,8 @@ export class Radio implements ComponentInterface, BalElementStateInfo, Loggable, ev.preventDefault() this.setFocus() - this.setChecked(!this.checked) + this.checked = true + this.setChecked(this.checked) } private onClick = (ev: MouseEvent) => {