Fix/31305 date input empty placeholder#48675
Open
Vladexy88x wants to merge 1 commit into
Open
Conversation
Deploy previewhttps://deploy-preview-48675--material-ui.netlify.app/ Bundle size
Check out the code infra dashboard for more information about this PR. |
Track the empty state of date-like inputs (date, datetime-local, month, time, week) and apply an `inputEmptyDateLike` state class so the native `::-webkit-datetime-edit` placeholder is greyed out like a regular text placeholder instead of appearing filled. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
ca79ef4 to
3c59289
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Native date/time inputs (type="date", "datetime-local", "month", "time", "week") render their value — and, when empty, a placeholder — through the ::-webkit-datetime-edit pseudo-elements using the input's color. As a result an empty field looked identical to a filled one.
This tracks the empty state of date-like inputs and applies a new inputEmptyDateLike state class so the native placeholder is dimmed like a regular text placeholder, with a smooth opacity transition.
Closes #31305
Changes
InputBase: track empty state for date-like input types and expose an isEmptyDateLikeInput ownerState flag.
New inputEmptyDateLike state class dimming ::-webkit-datetime-edit for empty date/time inputs.
Added unit tests and a regression fixture (EmptyDateTextField).
Regenerated API docs and translations.
in collaboration with Claude Code