Skip to content

Commit

Permalink
Don't reset horizontal padding on date/time pseudo-elements (#14959)
Browse files Browse the repository at this point in the history
Turns out all of these date/time pseudo elements have a bit of
horizontal padding on them that we don't want to throw away when fixing
the height issue, so this PR updates our reset to only remove vertical
padding.

Here's a demo showing the difference, test in Safari or Chrome to see
the difference in horizontal spacing:

https://play.tailwindcss.com/Opwa7pkDFP?file=css

---------

Co-authored-by: Adam Wathan <4323180+adamwathan@users.noreply.github.com>
  • Loading branch information
adamwathan and adamwathan authored Nov 11, 2024
1 parent 7da9272 commit 50d7355
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 17 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

- Nothing yet!
### Fixed

- Don't reset horizontal padding on date/time pseudo-elements ([#14959](https://github.com/tailwindlabs/tailwindcss/pull/14959))

## [4.0.0-alpha.32] - 2024-11-11

Expand Down
26 changes: 13 additions & 13 deletions packages/@tailwindcss-postcss/src/__snapshots__/index.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -518,44 +518,44 @@ exports[`\`@import 'tailwindcss'\` is replaced with the generated CSS 1`] = `
display: inline-flex;
}
::-webkit-datetime-edit {
::-webkit-datetime-edit-fields-wrapper {
padding: 0;
}
::-webkit-datetime-edit {
padding-block: 0;
}
::-webkit-datetime-edit-year-field {
padding: 0;
padding-block: 0;
}
::-webkit-datetime-edit-month-field {
padding: 0;
padding-block: 0;
}
::-webkit-datetime-edit-day-field {
padding: 0;
padding-block: 0;
}
::-webkit-datetime-edit-hour-field {
padding: 0;
padding-block: 0;
}
::-webkit-datetime-edit-minute-field {
padding: 0;
padding-block: 0;
}
::-webkit-datetime-edit-second-field {
padding: 0;
padding-block: 0;
}
::-webkit-datetime-edit-millisecond-field {
padding: 0;
padding-block: 0;
}
::-webkit-datetime-edit-meridiem-field {
padding: 0;
}
::-webkit-datetime-edit-fields-wrapper {
padding: 0;
padding-block: 0;
}
summary {
Expand Down
12 changes: 9 additions & 3 deletions packages/tailwindcss/preflight.css
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@ progress {
1. Ensure date/time inputs have the same height when empty in iOS Safari.
2. Ensure text alignment can be changed on date/time inputs in iOS Safari.
*/

::-webkit-date-and-time-value {
min-height: 1lh; /* 1 */
text-align: inherit; /* 2 */
Expand All @@ -256,13 +257,19 @@ progress {
/*
Prevent height from changing on date/time inputs in macOS Safari when the input is set to `display: block`.
*/

::-webkit-datetime-edit {
display: inline-flex;
}

/*
Remove excess padding from pseudo-elements in date/time inputs to ensure consistent height across browsers.
*/

::-webkit-datetime-edit-fields-wrapper {
padding: 0;
}

::-webkit-datetime-edit,
::-webkit-datetime-edit-year-field,
::-webkit-datetime-edit-month-field,
Expand All @@ -271,9 +278,8 @@ progress {
::-webkit-datetime-edit-minute-field,
::-webkit-datetime-edit-second-field,
::-webkit-datetime-edit-millisecond-field,
::-webkit-datetime-edit-meridiem-field,
::-webkit-datetime-edit-fields-wrapper {
padding: 0;
::-webkit-datetime-edit-meridiem-field {
padding-block: 0;
}

/*
Expand Down

0 comments on commit 50d7355

Please sign in to comment.