-
-
Notifications
You must be signed in to change notification settings - Fork 32.7k
Open
Labels
breaking changeIntroduces changes that are not backward compatible.Introduces changes that are not backward compatible.scope: text fieldChanges related to the text field.Changes related to the text field.typescript
Description
Hello 👋
Search keywords
undefined event onBlur
Latest version
- I have tested the latest version
Steps to reproduce
Steps:
- Open this link to live example: https://stackblitz.com/edit/react-zufzmfhc?file=Demo.tsx
- Type something in the input
- See in the console that the event passed to
onBluris undefined if the InputBase is disabled
Current behavior
InputBase is calling onBlur with an undefined event in certain cases, but the type definition for onBlur does not have a nullable event:
/**
* Callback fired when the `input` is blurred.
*
* Notice that the first argument (event) might be undefined.
*/
onBlur?: React.FocusEventHandler<HTMLInputElement | HTMLTextAreaElement>;
Even though there is a comment, undefined is not an option for the events.
Expected behavior
I would have expected the behavior of the onBlur to match the type definition and no undefined event to be passed in. Would it be possible to either update the type definition to include undefined or update the onBlur call to pass in an event for InputBase?
Context
We are running with strict null safety and this is causing an issue.
Your environment
See sandbox: https://stackblitz.com/edit/react-zufzmfhc?file=Demo.tsx
Thank you!
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
breaking changeIntroduces changes that are not backward compatible.Introduces changes that are not backward compatible.scope: text fieldChanges related to the text field.Changes related to the text field.typescript