From eac9de1b122f5480fd03f47e070a5518e6e7351a Mon Sep 17 00:00:00 2001 From: Taylor Jones Date: Thu, 20 Jul 2023 09:58:46 -0500 Subject: [PATCH] fix(textarea): persist onChange for React 16 (#14249) Co-authored-by: Andrea N. Cardona --- packages/react/src/components/TextArea/TextArea.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/react/src/components/TextArea/TextArea.tsx b/packages/react/src/components/TextArea/TextArea.tsx index 8605df43e3ea..d9a612e3febd 100644 --- a/packages/react/src/components/TextArea/TextArea.tsx +++ b/packages/react/src/components/TextArea/TextArea.tsx @@ -175,6 +175,7 @@ const TextArea = React.forwardRef((props: TextAreaProps, forwardRef) => { id, onChange: (evt) => { if (!other.disabled && onChange) { + evt.persist(); // delay textCount assignation to give the textarea element value time to catch up if is a controlled input setTimeout(() => { setTextCount(evt.target?.value?.length);