ACCESSIBILITY.md (+ Vietnamese mirror) states the WCAG 2.2 AA goal, what works, a keyboard reference, what was tested, known limitations and how to report a barrier; new accessibility issue template. Fixes from an audit: skip link, focus after navigation and consent, visible focus everywhere incl. forced-colors, Esc-then-Tab hint and aria-invalid on the input editor, a quieter status bar, names that match visible labels, translated screen-reader strings, page zoom in the desktop apps. axe-core scan in CI. Docs synced (vi PRIVACY/dev_env, README credits, ROADMAP). Version 2.2.0. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
47 lines
1.3 KiB
TypeScript
47 lines
1.3 KiB
TypeScript
import { cn } from '@/lib/utils';
|
|
|
|
interface ToolbarButtonProps {
|
|
onClick: () => void;
|
|
label: string;
|
|
icon: React.ReactNode;
|
|
disabled?: boolean;
|
|
/** Shown instead of `label` (visually) without changing the accessible name. */
|
|
visibleLabel?: string;
|
|
/** `aria-keyshortcuts` value, e.g. "Control+S". */
|
|
keyShortcuts?: string;
|
|
className?: string;
|
|
}
|
|
|
|
/**
|
|
* Compact icon + label button for panel headers. The `group` class lets icons
|
|
* animate on hover (`motion-safe:group-hover:…`); the label hides on narrow
|
|
* screens but stays the accessible name.
|
|
*/
|
|
export function ToolbarButton({
|
|
onClick,
|
|
label,
|
|
icon,
|
|
disabled,
|
|
visibleLabel,
|
|
keyShortcuts,
|
|
className,
|
|
}: ToolbarButtonProps) {
|
|
return (
|
|
<button
|
|
type="button"
|
|
onClick={onClick}
|
|
disabled={disabled}
|
|
aria-label={label}
|
|
aria-keyshortcuts={keyShortcuts}
|
|
title={label}
|
|
className={cn(
|
|
'group text-muted-foreground hover:bg-muted hover:text-foreground focus-visible:ring-ring inline-flex min-h-8 items-center gap-1.5 rounded-md px-2 text-xs transition outline-none focus-visible:ring-2 disabled:cursor-not-allowed disabled:opacity-40',
|
|
className,
|
|
)}
|
|
>
|
|
{icon}
|
|
<span className="hidden sm:inline">{visibleLabel ?? label}</span>
|
|
</button>
|
|
);
|
|
}
|