Capgemini / dcx-react-library

React Library UI/UX agnostic
https://main--6069a6f47f4b9f002171f8e1.chromatic.com
MIT License
113 stars 7 forks source link

CharacterCount component - should have a way to reset the text below the textarea. #437

Closed arpakuma closed 1 year ago

arpakuma commented 1 year ago

Describe the bug The text below the textarea displays the count of characters remaining, on form reset it is not going back to the maxLength (default) count.

To Reproduce Steps to reproduce the behavior:

  1. Add a CharacterCount component inside a form
  2. Add a cancel button which resets the form
  3. Type 3 characters inside the component. The message underneath says - You have 47 characters remaining. (Suppose your maxLength=50)
  4. Now click on cancel button. The message should say- You have 50 characters remaining but it is still counting 47

Expected behavior On form reset the message count should go back to the original count.

Screenshots

image

My maxLength is set to 50. I entered 3 characters before resetting. After form reset it is still showing 47.

Additional context Add any other context about the problem here.

daniele-zurico commented 1 year ago

closed by #443