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>
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
/** Show the remaining-count hint when this many characters (or fewer) are left. */
|
||||
export function remainingThreshold(maxLength: number): number {
|
||||
return Math.max(8, Math.min(50, Math.round(maxLength / 10)));
|
||||
}
|
||||
|
||||
export function characterRemainingVisible(length: number, maxLength: number): boolean {
|
||||
return maxLength - length <= remainingThreshold(maxLength);
|
||||
}
|
||||
|
||||
export function characterRemainingLabel(remaining: number, maxLength: number): string {
|
||||
return remaining <= 0 ? `已达 ${maxLength} 字上限` : `还剩 ${remaining} 字`;
|
||||
}
|
||||
|
||||
/** Stable live text: one announcement on entering the threshold, one at the cap. */
|
||||
export function characterRemainingAnnouncement(remaining: number, maxLength: number): string {
|
||||
return remaining <= 0 ? `已达 ${maxLength} 字上限` : "接近字数上限";
|
||||
}
|
||||
Reference in New Issue
Block a user