From 64a229cc059f97aa0e4a4619f835344910649beb Mon Sep 17 00:00:00 2001 From: Adam Wathan <4323180+adamwathan@users.noreply.github.com> Date: Wed, 13 Nov 2024 10:59:56 -0500 Subject: [PATCH 1/2] Ensure consistent opacity for disabled form controls in all browsers --- .../src/__snapshots__/index.test.ts.snap | 8 ++++++++ packages/tailwindcss/preflight.css | 17 +++++++++++------ 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/packages/@tailwindcss-postcss/src/__snapshots__/index.test.ts.snap b/packages/@tailwindcss-postcss/src/__snapshots__/index.test.ts.snap index 17c977f96e35..44a310d6b8bd 100644 --- a/packages/@tailwindcss-postcss/src/__snapshots__/index.test.ts.snap +++ b/packages/@tailwindcss-postcss/src/__snapshots__/index.test.ts.snap @@ -475,6 +475,14 @@ exports[`\`@import 'tailwindcss'\` is replaced with the generated CSS 1`] = ` color: inherit; } + ::file-selector-button:where() { + opacity: 1; + } + + :is(button, input, optgroup, select, textarea):where([disabled]) { + opacity: 1; + } + button, input:where([type="button"], [type="reset"], [type="submit"]) { appearance: button; background: none; diff --git a/packages/tailwindcss/preflight.css b/packages/tailwindcss/preflight.css index 6b8cbbae41db..deb1d01dd676 100644 --- a/packages/tailwindcss/preflight.css +++ b/packages/tailwindcss/preflight.css @@ -175,7 +175,8 @@ table { } /* - Inherit font styles in all browsers. + 1. Inherit font styles in all browsers. + 2. Ensure the opacity of disabled controls is consistent in all browsers; */ button, @@ -184,11 +185,15 @@ optgroup, select, textarea, ::file-selector-button { - font: inherit; - font-feature-settings: inherit; - font-variation-settings: inherit; - letter-spacing: inherit; - color: inherit; + font: inherit; /* 1 */ + font-feature-settings: inherit; /* 1 */ + font-variation-settings: inherit; /* 1 */ + letter-spacing: inherit; /* 1 */ + color: inherit; /* 1 */ + + &:where([disabled]) { + opacity: 1; /* 2 */ + } } /* From 82871eca077be97450e95fcbc310099abe4f2e43 Mon Sep 17 00:00:00 2001 From: Adam Wathan <4323180+adamwathan@users.noreply.github.com> Date: Wed, 13 Nov 2024 11:06:50 -0500 Subject: [PATCH 2/2] Update changelog --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0c7eed39ce31..174df9482784 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Support opacity values in increments of `0.25` by default ([#14980](https://github.com/tailwindlabs/tailwindcss/pull/14980)) - Support specifying the color interpolation method for gradients via modifier ([#14984](https://github.com/tailwindlabs/tailwindcss/pull/14984)) +### Changed + +- Set `opacity: 1` on disabled form controls in Preflight to ensure consistency across all browsers ([#14991](https://github.com/tailwindlabs/tailwindcss/pull/14991)) + ## [4.0.0-alpha.33] - 2024-11-11 ### Fixed