Skip to content

Commit

Permalink
fix: do not apply checkbox readonly background when disabled (#7733) (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
web-padawan authored Sep 2, 2024
1 parent e187de6 commit ed4c483
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 5 deletions.
12 changes: 12 additions & 0 deletions packages/checkbox/test/visual/lumo/checkbox.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,18 @@ describe('checkbox', () => {
element.required = true;
await visualDiff(div, 'disabled-required');
});

it('readonly checked', async () => {
element.readonly = true;
element.checked = true;
await visualDiff(div, 'disabled-readonly-checked');
});

it('readonly indeterminate', async () => {
element.readonly = true;
element.indeterminate = true;
await visualDiff(div, 'disabled-readonly-indeterminate');
});
});

describe('readonly', () => {
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 12 additions & 0 deletions packages/checkbox/test/visual/material/checkbox.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,18 @@ describe('checkbox', () => {
element.required = true;
await visualDiff(div, 'disabled-required');
});

it('readonly checked', async () => {
element.readonly = true;
element.checked = true;
await visualDiff(div, 'disabled-readonly-checked');
});

it('readonly indeterminate', async () => {
element.readonly = true;
element.indeterminate = true;
await visualDiff(div, 'disabled-readonly-indeterminate');
});
});

describe('RTL', () => {
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions packages/checkbox/theme/lumo/vaadin-checkbox-styles.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,8 @@ registerStyles(
background-color: var(--lumo-contrast-30pct);
}
:host([readonly][checked]) [part='checkbox'],
:host([readonly][indeterminate]) [part='checkbox'] {
:host([readonly][checked]:not([disabled])) [part='checkbox'],
:host([readonly][indeterminate]:not([disabled])) [part='checkbox'] {
background-color: var(--vaadin-checkbox-readonly-checked-background, var(--lumo-contrast-70pct));
}
Expand Down
6 changes: 3 additions & 3 deletions packages/checkbox/theme/material/vaadin-checkbox-styles.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,9 @@ registerStyles(
background-color: var(--material-disabled-color);
}
:host([readonly][checked]) [part='checkbox'],
:host([readonly][indeterminate]) [part='checkbox'],
:host([readonly]) [part='checkbox']::before {
:host([readonly][checked]:not([disabled])) [part='checkbox'],
:host([readonly][indeterminate]:not([disabled])) [part='checkbox'],
:host([readonly]:not([disabled])) [part='checkbox']::before {
background-color: var(--material-secondary-text-color);
}
Expand Down

0 comments on commit ed4c483

Please sign in to comment.