feat: add character counter to docs feedback form#3311
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a live character counter to the docs feedback form so people know about
the 2000 character limit before they submit, as requested in #2391.
The backend (
middleware/functions/feedback.ts) rejects comments longer thanMAX_COMMENT_LENGTH(2000), but the form gave no indication of the limit. Thisadds:
maxlengthof 2000 on the comment textarea, so the limit can't be exceededin the first place.
N / 2000counter below the textarea that updates as you type andturns red once the limit is reached.
While here, it also fixes a related bug: the submit handler showed "Thank you
for helping make the Deno docs awesome!" immediately, without waiting for the
request, so a failed submission (for example an over-limit comment) still showed
the success message. The handler now awaits the result and shows an error
message if the submission fails.
The
2000value is duplicated across the textarea, the browser script, and themiddleware (they live in separate server/browser files with no shared
constant), so each has a comment pointing at the others to keep them in sync.
Closes #2391