Skip to content

Commit

Permalink
fix(16892): fix maxWordCount issue in textaera
Browse files Browse the repository at this point in the history
  • Loading branch information
2nikhiltom committed Jun 28, 2024
1 parent ee20e94 commit e28036d
Showing 1 changed file with 5 additions and 1 deletion.
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

0 comments on commit e28036d

Please sign in to comment.