Skip to content

Commit

Permalink
fix(textarea): persist onChange for React 16 (#14249)
Browse files Browse the repository at this point in the history
Co-authored-by: Andrea N. Cardona <[email protected]>
  • Loading branch information
tay1orjones and andreancardona authored Jul 20, 2023
1 parent 66004ba commit eac9de1
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions packages/react/src/components/TextArea/TextArea.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit eac9de1

Please sign in to comment.