Help

Blocks SDK Request: Add onFocus & onBlur handler to Input component

Topic Labels: Custom Extensions
656 0
cancel
Showing results for 
Search instead for 
Did you mean: 
Andy_Cloke
8 - Airtable Astronomer
8 - Airtable Astronomer

The Input component is missing onFocus & onBlur handlers, which are pretty useful for e.g. form validation. At the moment the only way around it it is to use refs which gets pretty messy.
Current doing this:

...
useEffect(() => {
    if (inputRef && inputRef.current) {
      inputRef.current.onblur = console.log;
    }
  }, [inputRef]);

return (
       <Input
       ref={inputRef}
       value={value}
       onChange={handleChange}
/>
)

When I’d love to do this:

return (
       <Input
       onBlur={console.log}
       value={value}
       onChange={handleChange}
/>
0 Replies 0