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

Normalize date/time input styles #14931

Merged
merged 5 commits into from
Nov 8, 2024
Merged
Show file tree
Hide file tree
Changes from 3 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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Add `svh`, `dvh`, `svw`, `dvw`, and `auto` values to all width/height/size utilities ([#14857](https://github.com/tailwindlabs/tailwindcss/pull/14857))
- Add new `**` variant ([#14903](https://github.com/tailwindlabs/tailwindcss/pull/14903))
- Process `<style>` blocks inside Svelte files when using the Vite extension ([#14151](https://github.com/tailwindlabs/tailwindcss/pull/14151))
- Normalize date/time input styles in Preflight ([#14931](https://github.com/tailwindlabs/tailwindcss/pull/14931))
- _Upgrade (experimental)_: Migrate `grid-cols-[subgrid]` and `grid-rows-[subgrid]` to `grid-cols-subgrid` and `grid-rows-subgrid` ([#14840](https://github.com/tailwindlabs/tailwindcss/pull/14840))
- _Upgrade (experimental)_: Support migrating projects with multiple config files ([#14863](https://github.com/tailwindlabs/tailwindcss/pull/14863))
- _Upgrade (experimental)_: Rename `shadow` to `shadow-sm`, `shadow-sm` to `shadow-xs`, and `shadow-xs` to `shadow-2xs` ([#14875](https://github.com/tailwindlabs/tailwindcss/pull/14875))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -511,6 +511,55 @@ exports[`\`@import 'tailwindcss'\` is replaced with the generated CSS 1`] = `
-webkit-appearance: none;
}

::-webkit-date-and-time-value {
text-align: inherit;
min-height: 1lh;
}

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

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

::-webkit-datetime-edit-year-field {
padding: 0;
}

::-webkit-datetime-edit-month-field {
padding: 0;
}

::-webkit-datetime-edit-day-field {
padding: 0;
}

::-webkit-datetime-edit-hour-field {
padding: 0;
}

::-webkit-datetime-edit-minute-field {
padding: 0;
}

::-webkit-datetime-edit-second-field {
padding: 0;
}

::-webkit-datetime-edit-millisecond-field {
padding: 0;
}

::-webkit-datetime-edit-meridiem-field {
padding: 0;
}

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

summary {
display: list-item;
}
Expand Down
32 changes: 32 additions & 0 deletions packages/tailwindcss/preflight.css
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,38 @@ progress {
-webkit-appearance: none;
}

/*
1. Ensure date/time inputs have the same height when empty in on iOS Safari.
adamwathan marked this conversation as resolved.
Show resolved Hide resolved
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 */
}

/*
Prevent height from changing on date/time inputs on macOS Safari when the input is set to `display: block`.
adamwathan marked this conversation as resolved.
Show resolved Hide resolved
*/
::-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,
::-webkit-datetime-edit-year-field,
::-webkit-datetime-edit-month-field,
::-webkit-datetime-edit-day-field,
::-webkit-datetime-edit-hour-field,
::-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;
}

/*
Add the correct display in Chrome and Safari.
*/
Expand Down