From e28036d69a5961279cc9115db3a457df6f760a37 Mon Sep 17 00:00:00 2001 From: Nikhil Tomar Date: Fri, 28 Jun 2024 17:23:09 +0530 Subject: [PATCH] fix(16892): fix maxWordCount issue in textaera --- packages/react/src/components/TextArea/TextArea.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/react/src/components/TextArea/TextArea.tsx b/packages/react/src/components/TextArea/TextArea.tsx index 81236abd643b..6785ad74d60f 100644 --- a/packages/react/src/components/TextArea/TextArea.tsx +++ b/packages/react/src/components/TextArea/TextArea.tsx @@ -233,7 +233,10 @@ const TextArea = React.forwardRef((props: TextAreaProps, forwardRef) => { if (!disabled && enableCounter && counterMode === 'word') { const key = evt.which; - if (maxCount && textCount >= maxCount && key === 32) { + if ( + (maxCount && textCount >= maxCount && key === 32) || + (maxCount && textCount >= maxCount && key === 13) + ) { evt.preventDefault(); } } @@ -424,6 +427,7 @@ const TextArea = React.forwardRef((props: TextAreaProps, forwardRef) => { {...other} {...textareaProps} placeholder={placeholder} + aria-readonly={other.readOnly ? true : false} className={textareaClasses} aria-invalid={invalid} aria-describedby={ariaDescribedBy}