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 JS validation for word count in textarea #3001

Merged
merged 1 commit into from
Jul 16, 2024
Merged

Fix JS validation for word count in textarea #3001

merged 1 commit into from
Jul 16, 2024

Conversation

DaniBitZesty
Copy link
Contributor

@DaniBitZesty DaniBitZesty commented Jul 15, 2024

📝 A short description of the changes

  • When text is pasted into textareas, spaces are converted to non-breaking spaces ( ) and line breaks to (\n), previous code was counting words by spaces and ignoring these.
  • Also, step validation was not working on these questions, this PR changes use of .context to .find('textarea') instead, which correctly identifies the textarea element in both validate and validateStep functions

🔗 Link to the relevant story (or stories)

:shipit: Deployment implications

✅ Checklist

  • Features that cannot go live are behind a feature flag/env var or specify deploy date and open PR as draft
  • I have checked that commit messages make sense and explain the reasoning for each change
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • I have squashed any unnecessary or part-finished commits

🖼️ Screenshots (if appropriate - no PII/Prod data):

…-breaking spaces ( ).

Also, count new lines as words.
Change use of .context to .find('textarea') instead to fix step validation.
@DaniBitZesty DaniBitZesty merged commit d73681b into main Jul 16, 2024
11 checks passed
@DaniBitZesty DaniBitZesty deleted the wordcount branch July 16, 2024 08:48
@TheDancingClown TheDancingClown mentioned this pull request Jul 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants