diff --git a/client/src/components/ReviewForm.css b/client/src/components/ReviewForm.css index 1367d6e..714f28d 100644 --- a/client/src/components/ReviewForm.css +++ b/client/src/components/ReviewForm.css @@ -69,6 +69,12 @@ min-width: 0; max-width: 100%; } +.review-form__comment-counter { + color: var(--muted); + font-size: 0.875rem; + margin: 0.4rem 0 0; + text-align: right; +} .review-form__actions { display: flex; flex-wrap: wrap; diff --git a/client/src/components/ReviewForm.test.tsx b/client/src/components/ReviewForm.test.tsx index 57f7165..040dc4b 100644 --- a/client/src/components/ReviewForm.test.tsx +++ b/client/src/components/ReviewForm.test.tsx @@ -25,6 +25,27 @@ it('requires an accessible 1 to 5 star choice before it saves', () => { 'maxlength', '2000', ); + expect(screen.getByText('0 / 2,000 characters')).toBeInTheDocument(); + expect(screen.getByRole('textbox')).toHaveAttribute( + 'aria-describedby', + 'review-comment-counter', + ); +}); + +it('updates the character counter without announcing every keystroke', () => { + render( + + + , + ); + + fireEvent.change(screen.getByRole('textbox'), { + target: { value: 'A classic.' }, + }); + + const counter = screen.getByText('10 / 2,000 characters'); + expect(counter).toHaveAttribute('id', 'review-comment-counter'); + expect(counter).not.toHaveAttribute('aria-live'); }); it.each([ diff --git a/client/src/components/ReviewForm.tsx b/client/src/components/ReviewForm.tsx index 902160b..af8f9da 100644 --- a/client/src/components/ReviewForm.tsx +++ b/client/src/components/ReviewForm.tsx @@ -140,7 +140,12 @@ export default function ReviewForm({ albumId, review, onChanged }: Props) { disabled={busy} maxLength={MAX_COMMENT_LENGTH} rows={4} + aria-describedby="review-comment-counter" /> +

+ {comment.length.toLocaleString('en-US')} /{' '} + {MAX_COMMENT_LENGTH.toLocaleString('en-US')} characters +

{error &&

{error}

} {status && (

diff --git a/docs/AI-USAGE.md b/docs/AI-USAGE.md index f272ce0..e95c2c6 100644 --- a/docs/AI-USAGE.md +++ b/docs/AI-USAGE.md @@ -111,6 +111,7 @@ the part that matters most. | 2026-11-22 | evenkkl | Claude | #96, skip count and facet queries on Load more: Claude made the search aggregates lazy `AlbumConnection` field resolvers, added a `SearchAlbumsPage` query for Load more, kept page one's count and facets in the Apollo merge, and added server and client tests. Verified with lint, typecheck, the test suites and the PostgreSQL tests on PGlite. | | 2026-11-22 | erikhfj | Antigravity | #117, stabilized `ReviewForm.test.tsx`: traced the intermittent CI failure (run `88055`) to `findByRole('status')` resolving via `MutationObserver` before React's passive `useEffect` focused `statusRef`, and wrapped the status focus assertions in `waitFor`. Verified with 10 consecutive test runs plus `pnpm format:check && pnpm lint && pnpm typecheck && pnpm test`. | | 2026-11-22 | erikhfj | Antigravity | #107, documented the team's AI task delegation, verification, and review workflow in `docs/AI-USAGE.md`, reflecting actual practices across all four contributors and complementing #97's prompt-context section. Verified with `pnpm format:check && pnpm lint && pnpm typecheck && pnpm test`. | +| 2026-11-23 | robertky | Codex (ChatGPT) | #94: Added an accessible character count for review comments, linked it to the textarea without live announcements on every keystroke, and added component tests. Verified with `pnpm format:check`, `pnpm lint`, `pnpm typecheck`, `pnpm test`, and `pnpm build`. | | 2026-11-23 | robertky | Codex (ChatGPT) | #104 review follow-up: combined the side drawer with the merged country preview, added backdrop dismissal and a keyboard focus loop, corrected the results-status test matcher and component documentation, and expanded the Playwright filter journey. Verified with `pnpm format:check`, `pnpm lint`, `pnpm typecheck`, `pnpm test`, `pnpm build`, and `pnpm test:e2e` against an isolated seeded PostgreSQL database. | ## Task delegation and verification workflow