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

[material-ui][Autocomplete] onInputChange called with undefined event contrary to type definition #43899

Open
sydneyjodon-wk opened this issue Sep 26, 2024 · 0 comments
Assignees
Labels
component: autocomplete This is the name of the generic UI component, not the React module! status: waiting for maintainer These issues haven't been looked at yet by a maintainer

Comments

@sydneyjodon-wk
Copy link
Contributor

sydneyjodon-wk commented Sep 26, 2024

Steps to reproduce

Link to live example: (required) https://stackblitz.com/edit/react-ouzbqw?file=Demo.tsx

Steps:

  1. Set the onInputChange prop
  2. Check what is passed in for the event param

Current behavior

Hello 👋

I'm noticing that the onInputChange is typed as:

onInputChange?: (
    event: React.SyntheticEvent,
    value: string,
    reason: AutocompleteInputChangeReason,
) => void;

with a non-null event param, but null seems to be coming through for the param on mount. See demo:

onInputChange-null-event

Expected behavior

I'm not sure if onInputChange is supposed to be called on mount or not, but if it is and it's expected that null is an option for event, would it be possible to update the typing of onInputChange to reflect that?

Thanks!

Context

We are trying to use strict null safety

Your environment

See https://stackblitz.com/edit/react-ouzbqw?file=Demo.tsx - also reproduce-able in this docs demo

Search keywords: onInputChange undefined event

@sydneyjodon-wk sydneyjodon-wk added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Sep 26, 2024
@zannager zannager added the component: autocomplete This is the name of the generic UI component, not the React module! label Sep 27, 2024
@sai6855 sai6855 self-assigned this Sep 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: autocomplete This is the name of the generic UI component, not the React module! status: waiting for maintainer These issues haven't been looked at yet by a maintainer
Projects
None yet
Development

No branches or pull requests

4 participants