Skip to content

Fix date input height on iOS Safari 18.4–18.6#47923

Open
spider-yamet wants to merge 6 commits intomui:masterfrom
spider-yamet:fix/iOS-date-input
Open

Fix date input height on iOS Safari 18.4–18.6#47923
spider-yamet wants to merge 6 commits intomui:masterfrom
spider-yamet:fix/iOS-date-input

Conversation

@spider-yamet
Copy link

@spider-yamet spider-yamet commented Mar 6, 2026

Summary

Fixes shrunken height of TextField with type="date" (and other temporal types) on small iOS devices (iPhone SE, iPhone 16e) on iOS 18.4–18.6.

Closes #47733

Problem

On iOS Safari (and Chrome on iOS), <TextField type="date" /> and other temporal inputs (time, datetime-local, month, week) can render with collapsed height compared to text inputs. Root cause: WebKit bug 198959 and Safari’s shadow DOM padding for native date/time controls.

Solution

  • In InputBase, treat temporal input types explicitly and apply a new inputTypeTemporal variant that:
    • Sets minHeight: 1.4375em on the input and ::-webkit-date-and-time-value so the field doesn’t collapse when empty.
    • Sets padding: 0 on WebKit temporal pseudo-elements (::-webkit-datetime-edit*, etc.) so height matches other inputs.
    • Sets ::-webkit-inner-spin-button { height: auto } for the native picker icon.
  • Added inputBaseClasses.inputTypeTemporal and temporal-type detection (isTemporalInputType) used in overrides resolver and utility classes.
  • Tests: InputBase and TextField tests added to assert that temporal types get inputTypeTemporal and non-temporal types do not.

Files changed

  • packages/mui-material/src/InputBase/InputBase.js – temporal detection + styled variant
  • packages/mui-material/src/InputBase/inputBaseClasses.tsinputTypeTemporal class

##Fixes
#47733

@mui-bot
Copy link

mui-bot commented Mar 6, 2026

Netlify deploy preview

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

Bundle size report

Bundle Parsed size Gzip size
@mui/material 🔺+794B(+0.15%) 🔺+236B(+0.16%)
@mui/lab 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

Generated by 🚫 dangerJS against 551c337

@spider-yamet
Copy link
Author

hi @mj12albert could you please review my PR? :)

@zannager zannager added the scope: text field Changes related to the text field. label Mar 6, 2026
@zannager zannager requested a review from mj12albert March 6, 2026 14:14
Copy link
Member

@mj12albert mj12albert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given that this is a WebKit bug we should just do a pure CSS fix in the InputBase styles (using the attr selectors &[type="date"], &[type="time"], &[type="datetime-local"] etc) without touching the existing API/classes

{
props: ({ ownerState }) => isTemporalInputType(ownerState.type),
style: {
minHeight: '1.4375em',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 type date doesn't render fully on small iOS devices on versions 18.4-18.6

4 participants