fix(a11y): switch semantics for admin form toggles

Add role=switch + aria-checked + aria-label to 12 ad-hoc toggle buttons across admin
create/edit forms (AdminCampaignCreate/Edit, AdminPromocodeCreate, AdminPromoGroupCreate,
AdminPromoOfferTemplateEdit, AdminPaymentMethodEdit, AdminTariffCreate) so screen readers
announce on/off state (WCAG 4.1.2).
This commit is contained in:
c0mrade
2026-05-26 00:03:17 +03:00
parent 491f48a331
commit 7b0a72db5b
7 changed files with 35 additions and 0 deletions

View File

@@ -855,6 +855,9 @@ export default function AdminTariffCreate() {
<button
type="button"
onClick={() => setTrafficTopupEnabled(!trafficTopupEnabled)}
role="switch"
aria-checked={trafficTopupEnabled}
aria-label={t('admin.tariffs.extraTrafficTitle')}
className={`relative h-6 w-11 rounded-full transition-colors ${
trafficTopupEnabled ? 'bg-accent-500' : 'bg-dark-600'
}`}
@@ -1117,6 +1120,9 @@ export default function AdminTariffCreate() {
<button
type="button"
onClick={() => setIsActive(!isActive)}
role="switch"
aria-checked={isActive}
aria-label={t('admin.tariffs.isActiveLabel')}
className={`relative h-6 w-11 rounded-full transition-colors ${
isActive ? 'bg-success-500' : 'bg-dark-600'
}`}
@@ -1139,6 +1145,9 @@ export default function AdminTariffCreate() {
<button
type="button"
onClick={() => setShowInGift(!showInGift)}
role="switch"
aria-checked={showInGift}
aria-label={t('admin.tariffs.showInGiftLabel')}
className={`relative h-6 w-11 rounded-full transition-colors ${
showInGift ? 'bg-accent-500' : 'bg-dark-600'
}`}