Skip to content

Fix/31305 date input empty placeholder#48675

Closed
Vladexy88x wants to merge 1 commit into
mui:masterfrom
Vladexy88x:fix/31305-date-input-empty-placeholder
Closed

Fix/31305 date input empty placeholder#48675
Vladexy88x wants to merge 1 commit into
mui:masterfrom
Vladexy88x:fix/31305-date-input-empty-placeholder

Conversation

@Vladexy88x

@Vladexy88x Vladexy88x commented Jun 16, 2026

Copy link
Copy Markdown

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

@code-infra-dashboard

code-infra-dashboard Bot commented Jun 16, 2026

Copy link
Copy Markdown

Deploy preview

https://deploy-preview-48675--material-ui.netlify.app/

Bundle size

Bundle Parsed size Gzip size
@mui/material 🔺+405B(+0.08%) 🔺+130B(+0.09%)
@mui/lab 0B(0.00%) 0B(0.00%)
@mui/private-theming 0B(0.00%) 0B(0.00%)
@mui/system 0B(0.00%) 0B(0.00%)
@mui/utils 0B(0.00%) 0B(0.00%)

Details of bundle changes


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>
@Vladexy88x Vladexy88x force-pushed the fix/31305-date-input-empty-placeholder branch from ca79ef4 to 3c59289 Compare June 16, 2026 11:43
@zannager zannager added the scope: text field Changes related to the text field. label Jun 22, 2026
@zannager zannager requested a review from silviuaavram June 22, 2026 11:07
@mj12albert mj12albert closed this Jun 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope: text field Changes related to the text field.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[TextField] Placeholder doesn't differ from filled value on Safari when type="date"

3 participants