scania-digital-design-system / tegel

Tegel Design System
https://tegel.scania.com
MIT License
19 stars 14 forks source link

[Bug report]: Tds-button disabled state only disables internal button and not tds-button wrapper #833

Open scania-mharlin opened 1 week ago

scania-mharlin commented 1 week ago

Requirements before reporting

Package versions

"@scania/tegel-angular": "1.18.0",

Browser

Chrome

Framework

Angular

Version

Angular 18

Reproduction steps

  1. Add component tds-button
  2. Add click event listener to button and set disabled to be true
  3. Add padding to the button
  4. Click on the padding of the button
  5. The click event is triggered even though the button is disabled

Code example

html

  <tds-button
    style="padding: 50px; background-color: fuchsia"
    [disabled]="true"
    type="button"
    variant="primary"
    (click)="clickButton()"
    text="test">
  </tds-button>

script

  clickButton(): void {
    console.log("button clicked");
  }

Screenshots

Add/Copy screenshot here

Expected behaviour

This is mainly a problem for our test automation where our automation finds and clicks on the tds-button even though the button inside is still in a disabled state. This also means it's possible to trigger the click event of the tds-button programmatically when it's in a disabled state.

expected

It should not be able to trigger the click event for the Tds-button when it is in a disabled state

Console errors

Add warning/error message

Contact information

magnus.harlin@scania.com