About this set
Three comment forms for the moment a reader decides to say something. The guest comment form is the classic blog layout: name, email with a Never shown publicly hint, an optional website, a comment box with a live character count, a notify-me checkbox and a Post comment button. The signed-in comment box shows who is commenting and adds a formatting toolbar that wraps the selected text in markdown for bold, italic, code, links, quotes and lists. The signed-out prompt replaces the form with Sign in and Create account links. Use the guest form on open blogs, the toolbar box on communities with accounts, and the prompt where only members may comment. The count turns amber near the limit and red past it, and a hidden live region announces it only when it changes level, not on every key. On submit the script checks the required fields, writes an error under each problem field, marks it aria-invalid and focuses the first one; a valid form moves the button through Posting and Posted states and shows a confirmation. It is frontend only: replace the timeout with your own request.
What’s included
- Live character count that warns near the limit and blocks posting past it
- Markdown toolbar that wraps the selection or inserts placeholder text
- Inline errors linked with aria-describedby and aria-invalid
- Idle, Posting and Posted button states with a spinner and a success message
- A signed-out prompt with Sign in and Create account links
Accessibility
Every field has a visible label, hints and errors are linked with aria-describedby, and invalid fields get aria-invalid and focus on submit. The character count is read with the field and announced through a polite live region only when it nears or passes the limit. Toolbar buttons have text names, the busy submit button uses aria-disabled instead of disappearing from the tab order, and every control shows a focus outline or ring; the spinner stops under prefers-reduced-motion.
Customise it
Change --cf-accent, --cf-field, --cf-err and --cf-ok on .cf for colour and data-max on the textarea for the limit. In Bootstrap the same variables restyle .form-control, .btn and .alert; in Tailwind edit the --color-cf-* theme colours.






