Skip to content

Commit

Permalink
fix: do not apply checkbox readonly background when disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
web-padawan committed Sep 2, 2024
1 parent 6d1f332 commit 2598dcb
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 @@ -92,6 +92,18 @@ describe('checkbox', () => {
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('styled', () => {
before(() => {
document.documentElement.style.setProperty('--vaadin-checkbox-disabled-checkmark-color', 'white');
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 @@ -171,8 +171,8 @@ registerStyles(
background-color: var(--_disabled-checkmark-color);
}
: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 @@ -126,9 +126,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 2598dcb

Please sign in to comment.