Files
Jyotisha/frontend/src/components/character-remaining.tsx
T
Jesse_ChenandCursor e8fa1ce4ea
Independent Staging Quality Gate / validate (push) Successful in 9m19s
Independent Staging Quality Gate / publish (push) Successful in 9m54s
fix(frontend): raise dark contrast, expand hit areas, and surface input limits
Dark muted surfaces missed WCAG AA; action and tertiary tokens plus a 32-pair contract close that. Hit targets, remaining-count, and Enter-to-send follow the interaction audit without changing visual sizes.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-30 11:19:50 +08:00

32 lines
781 B
TypeScript

import {
characterRemainingAnnouncement,
characterRemainingLabel,
characterRemainingVisible,
} from "@/lib/character-remaining";
export function CharacterRemaining({
id,
length,
maxLength,
}: {
id: string;
length: number;
maxLength: number;
}) {
if (!characterRemainingVisible(length, maxLength)) return null;
const remaining = maxLength - length;
const atLimit = remaining <= 0;
return (
<span
id={id}
className="character-remaining"
data-limit={atLimit ? "true" : undefined}
aria-live="polite"
aria-atomic="true"
>
<span aria-hidden="true">{characterRemainingLabel(remaining, maxLength)}</span>
<span className="sr-only">{characterRemainingAnnouncement(remaining, maxLength)}</span>
</span>
);
}