diff --git a/packages/input-container/test/visual/lumo/input-container.test.js b/packages/input-container/test/visual/lumo/input-container.test.js index 6d225d6509..95d795aee2 100644 --- a/packages/input-container/test/visual/lumo/input-container.test.js +++ b/packages/input-container/test/visual/lumo/input-container.test.js @@ -33,6 +33,14 @@ describe('input-container', () => { await visualDiff(div, `${initialState}-disabled`); }); + it('styled disabled', async () => { + div.style.setProperty('--vaadin-input-field-disabled-background', 'black'); + div.style.setProperty('--vaadin-input-field-disabled-value-color', 'white'); + + element.disabled = true; + await visualDiff(div, `${initialState}-styled-disabled`); + }); + it('readonly', async () => { element.readonly = true; await visualDiff(div, `${initialState}-readonly`); diff --git a/packages/input-container/test/visual/lumo/screenshots/input-container/baseline/empty-styled-disabled.png b/packages/input-container/test/visual/lumo/screenshots/input-container/baseline/empty-styled-disabled.png new file mode 100644 index 0000000000..733731d36a Binary files /dev/null and b/packages/input-container/test/visual/lumo/screenshots/input-container/baseline/empty-styled-disabled.png differ diff --git a/packages/input-container/test/visual/lumo/screenshots/input-container/baseline/non-empty-styled-disabled.png b/packages/input-container/test/visual/lumo/screenshots/input-container/baseline/non-empty-styled-disabled.png new file mode 100644 index 0000000000..7d46c0aef0 Binary files /dev/null and b/packages/input-container/test/visual/lumo/screenshots/input-container/baseline/non-empty-styled-disabled.png differ diff --git a/packages/input-container/theme/lumo/vaadin-input-container-styles.js b/packages/input-container/theme/lumo/vaadin-input-container-styles.js index 8179db1dd4..8cbd61cddc 100644 --- a/packages/input-container/theme/lumo/vaadin-input-container-styles.js +++ b/packages/input-container/theme/lumo/vaadin-input-container-styles.js @@ -32,6 +32,8 @@ registerStyles( --_icon-size: var(--vaadin-input-field-icon-size, var(--lumo-icon-size-m)); --_invalid-background: var(--vaadin-input-field-invalid-background, var(--lumo-error-color-10pct)); --_invalid-hover-highlight: var(--vaadin-input-field-invalid-hover-highlight, var(--lumo-error-color-50pct)); + --_disabled-background: var(--vaadin-input-field-disabled-background, var(--lumo-contrast-5pct)); + --_disabled-value-color: var(--vaadin-input-field-disabled-value-color, var(--lumo-disabled-text-color)); } :host([dir='rtl']) { @@ -82,12 +84,9 @@ registerStyles( /* Disabled */ :host([disabled]) { - background-color: var(--lumo-contrast-5pct); - } - - :host([disabled]) ::slotted(*) { - color: var(--lumo-disabled-text-color); - -webkit-text-fill-color: var(--lumo-disabled-text-color); + background: var(--_disabled-background); + -webkit-text-fill-color: var(--_disabled-value-color); + color: var(--_disabled-value-color); } /* Invalid */ diff --git a/packages/vaadin-lumo-styles/style.js b/packages/vaadin-lumo-styles/style.js index 2ba9c9ebb2..e18fdd4b4e 100644 --- a/packages/vaadin-lumo-styles/style.js +++ b/packages/vaadin-lumo-styles/style.js @@ -98,6 +98,8 @@ const globals = css` --vaadin-input-field-icon-size: var(--lumo-icon-size-m); --vaadin-input-field-invalid-background: var(--lumo-error-color-10pct); --vaadin-input-field-invalid-hover-highlight: var(--lumo-error-color-50pct); + --vaadin-input-field-disabled-background: var(--lumo-contrast-5pct); + --vaadin-input-field-disabled-value-color: var(--lumo-disabled-text-color); --vaadin-input-field-height: var(--lumo-size-m); --vaadin-input-field-hover-highlight: var(--lumo-contrast-50pct); --vaadin-input-field-placeholder-color: var(--lumo-secondary-text-color);