Skip to content

Bug - TextArea - The onFocus and onBlur props are overwritten with an invalid type signature #10192

@jonkoops

Description

@jonkoops

Describe the problem
The onFocus and onBlur props are overwritten in the TextArea component. However, the event parameter for these callbacks has been made optional in the overwritten type. This causes issues with libraries that expect this type signature to math the ones from a native React <textarea> element.

How do you reproduce the problem?
Set up a form using React Hook Form with a PatternFly TextArea component in a TypeScript environment, for example:

import { TextArea } from "@patternfly/react-core";
import { useForm } from "react-hook-form";

export default function App() {
  const { register handleSubmit } = useForm();

  return (
    <TextArea {...register("example")} />
  )
}

Expected behavior
No compilation errors occur.

Actual behaviour
The compilation fails on a type error on the mismatched signatures of onFocus and onBlur.

Is this issue blocking you?
Yes, this is preventing us from upgrading to PatternFly 5.

Screenshots
A screenshot showing the aforementioned type error.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Status

Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions