Skip to content

[react-aria] useTextField returns onBlur null instead of undefined #3861

@DeLm0re

Description

@DeLm0re

🐛 Bug Report

I do not know if this is intentional or not, but I think there is an issue with the useTextField hook in react-aria.
All event handlers returned are set to undefined when not defined except onBlur which is returned as null.

At first, it does not seem worrying, but when it comes to mergeProps things become a little more spicy.
In fact, when you try to merge props coming from react-aria with props coming for on another library (react-number-format in my case) then mergeProps results in onBlur defined as null so when activated, it prompts an error in console.

onBlur is not a function

I do not know if it is a constraint in the library code but it would be great if onBlur was returned as undefined. Plus it makes more sense considering all other handlers work like that.

💻 Code Sample

https://codesandbox.io/s/condescending-parm-s6wufv?file=/src/App.tsx

🌍 Your Environment

MacOs
React 18.2
With and without Vite 4.0.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions