Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: do not apply checkbox readonly background when disabled (#7733) (CP: 24.4) #7739

Merged
merged 1 commit into from
Sep 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading