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

Conversation

adamwathan
Copy link
Member

This PR adds some additional styles to Preflight to normalize a bunch of inconsistencies in date/time inputs across browsers.

The main motivation for this is to remove these insane classes we have to add in Catalyst:

<input type="date" class="[&::-webkit-datetime-edit-fields-wrapper]:p-0 [&::-webkit-date-and-time-value]:min-h-[1.5em]
[&::-webkit-datetime-edit]:inline-flex [&::-webkit-datetime-edit]:p-0 [&::-webkit-datetime-edit-year-field]:p-0
[&::-webkit-datetime-edit-month-field]:p-0 [&::-webkit-datetime-edit-day-field]:p-0
[&::-webkit-datetime-edit-hour-field]:p-0 [&::-webkit-datetime-edit-minute-field]:p-0
[&::-webkit-datetime-edit-second-field]:p-0 [&::-webkit-datetime-edit-millisecond-field]:p-0
[&::-webkit-datetime-edit-meridiem-field]:p-0"/>

With these normalizations, changing things like padding, display type, etc. gives consistent results (at least as consistent as is actually possible) across all browsers.


Make text alignment work on iOS Safari

iOS Safari text alignment


Don't shrink date inputs on iOS Safari when there is no selected value

ioS Safari no input


Fix padding in macOS Safari

MacOS Safari

@adamwathan adamwathan requested a review from a team as a code owner November 8, 2024 21:23
@adamwathan adamwathan merged commit 5da6968 into next Nov 8, 2024
1 check passed
@adamwathan adamwathan deleted the feat/reset-datetime-inputs branch November 8, 2024 21:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant