Skip to content

[TextField] Accept ChangeEvent<HTMLSelectElement> in onChange - #49937

Open
tranhoangtu-it wants to merge 1 commit into
mui:masterfrom
tranhoangtu-it:fix/textfield-select-onchange-type
Open

tranhoangtu-it wants to merge 1 commit into
mui:masterfrom
tranhoangtu-it:fix/textfield-select-onchange-type

Conversation

@tranhoangtu-it

Copy link
Copy Markdown

Closes #33742

Summary

When using <TextField select onChange={...} />, TypeScript previously rejected explicit React.ChangeEvent<HTMLSelectElement> handlers because StandardTextFieldProps, FilledTextFieldProps, and OutlinedTextFieldProps inherited onChange directly from InputBaseProps (React.ChangeEventHandler<HTMLTextAreaElement | HTMLInputElement>).

This PR introduces TextFieldChangeEventHandler = React.ChangeEventHandler<HTMLTextAreaElement | HTMLInputElement | HTMLSelectElement> in packages/mui-material/src/TextField/TextField.d.ts and applies it to StandardTextFieldProps, FilledTextFieldProps, and OutlinedTextFieldProps, while preserving existing inference (event.target.value: string) and input/textarea handler compatibility.

Verification

  • pnpm --filter @mui/material typescript: passed
  • pnpm --filter docs typescript: passed (docs + docs/scripts)
  • pnpm typescript (lerna run --no-bail typescript): 20/20 workspace projects passed
  • pnpm test:unit run packages/mui-material/src/TextField/TextField.test.js: 148 passed, 8 skipped across browser:@mui/material (chromium) and node:@mui/material
  • pnpm tsx ./scripts/buildApiDocs/index.ts --grep "^TextField$": passed (0 API-doc diffs)
  • ESLint & Prettier --check on both modified files: passed

@chatgpt-codex-connector

Copy link
Copy Markdown
Codex Review Summary: ❌ Failed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ❌ Failed 2026-11-28T04:38:29.816774Z
We couldn’t complete this review. Comment @codex review to try again.
c4e0830 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@code-infra-dashboard

code-infra-dashboard Bot commented Nov 28, 2026 •

Copy link
Copy Markdown

Deploy preview

https://deploy-preview-49937--material-ui.netlify.app/
QR code for https://deploy-preview-49937--material-ui.netlify.app/

Bundle size

Bundle Parsed size Gzip size
@mui/material 0B(0.00%) 0B(0.00%)
@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

Performance

No regressions in 32 benchmarks · precise to ±3.0% (±9.9% at worst) · ran 2m 05s · details


Check out the code infra dashboard for more information about this PR.

This branch has not been deployed

No deployments
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.

[TextField] When TextField is used as select, onChange handler type should be ChangeEvent<HTMLSelectElement>

2 participants