Skip to content

feat: add character counter to docs feedback form#3311

Merged
bartlomieju merged 1 commit into
mainfrom
docs-feedback-char-counter
Jun 18, 2026
Merged

feat: add character counter to docs feedback form#3311
bartlomieju merged 1 commit into
mainfrom
docs-feedback-char-counter

Conversation

@bartlomieju

Copy link
Copy Markdown
Member

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 than
MAX_COMMENT_LENGTH (2000), but the form gave no indication of the limit. This
adds:

  • A maxlength of 2000 on the comment textarea, so the limit can't be exceeded
    in the first place.
  • A live N / 2000 counter below the textarea that updates as you type and
    turns 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 2000 value is duplicated across the textarea, the browser script, and the
middleware (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

@bartlomieju
bartlomieju merged commit 1a63c41 into main Jun 18, 2026
3 checks passed
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.

add a character count to the feedback form to warn people of the 2000 char limit

1 participant