Skip to content

Commit

Permalink
fix(datagrid): disable row checkbox/radio button in Angular v15
Browse files Browse the repository at this point in the history
This is a workaround for a regression that was introduced in Angular v15.
See angular/angular#48350 for details.

closes #520
  • Loading branch information
kevinbuhmann committed Feb 28, 2023
1 parent 6479e36 commit 95ebfb4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions projects/angular/src/data/datagrid/datagrid-row.html
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
[ngModel]="selected"
(ngModelChange)="toggle($event)"
[id]="checkboxId"
[attr.disabled]="clrDgSelectable ? null : true"
[disabled]="clrDgSelectable ? null : true"
[attr.aria-disabled]="clrDgSelectable ? null : true"
[attr.aria-label]="clrDgRowAriaLabel"
/>
Expand Down Expand Up @@ -76,7 +76,7 @@
[value]="item"
[(ngModel)]="selection.currentSingle"
[checked]="selection.currentSingle === item"
[attr.disabled]="clrDgSelectable ? null : true"
[disabled]="clrDgSelectable ? null : true"
[attr.aria-disabled]="clrDgSelectable ? null : true"
[attr.aria-label]="clrDgRowAriaLabel"
/>
Expand Down
4 changes: 2 additions & 2 deletions projects/angular/src/data/datagrid/datagrid-row.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ export default function (): void {
context.detectChanges();
checkbox = context.clarityElement.querySelector("input[type='checkbox']");

expect(checkbox.getAttribute('disabled')).toBe('true');
expect(checkbox.getAttribute('disabled')).toBeDefined();
expect(checkbox.getAttribute('aria-disabled')).toBe('true');

context.clarityDirective.toggle();
Expand Down Expand Up @@ -154,7 +154,7 @@ export default function (): void {
context.detectChanges();
checkbox = context.clarityElement.querySelector("input[type='checkbox']");

expect(checkbox.getAttribute('disabled')).toBe('true');
expect(checkbox.getAttribute('disabled')).toBeDefined();
expect(checkbox.getAttribute('aria-disabled')).toBe('true');

context.clarityDirective.toggle();
Expand Down

0 comments on commit 95ebfb4

Please sign in to comment.