Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix : Prevents exceeding maxCount word limit in TextAera #16893

Merged
6 changes: 5 additions & 1 deletion packages/react/src/components/TextArea/TextArea.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}
Expand Down Expand Up @@ -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}
Expand Down
Loading