mirror of
https://github.com/chillpadclub/bedolaga-cabinet.git
synced 2026-07-28 09:33:46 +00:00
fix(a11y): switch semantics for user-flow toggles
Add role=switch + aria-checked + aria-label to the custom toggle buttons so screen readers announce on/off state (WCAG 4.1.2): autopay (Subscription) and the custom-days / custom-traffic toggles (SubscriptionPurchase).
This commit is contained in:
@@ -1172,6 +1172,9 @@ export default function Subscription() {
|
|||||||
<button
|
<button
|
||||||
onClick={() => autopayMutation.mutate(!subscription.autopay_enabled)}
|
onClick={() => autopayMutation.mutate(!subscription.autopay_enabled)}
|
||||||
disabled={autopayMutation.isPending}
|
disabled={autopayMutation.isPending}
|
||||||
|
role="switch"
|
||||||
|
aria-checked={subscription.autopay_enabled}
|
||||||
|
aria-label={t('subscription.autopay.title', 'Auto-payment')}
|
||||||
className="relative h-7 w-[52px] rounded-full transition-colors duration-300"
|
className="relative h-7 w-[52px] rounded-full transition-colors duration-300"
|
||||||
style={{
|
style={{
|
||||||
background: subscription.autopay_enabled ? zone.mainHex : g.textGhost,
|
background: subscription.autopay_enabled ? zone.mainHex : g.textGhost,
|
||||||
|
|||||||
@@ -1238,6 +1238,9 @@ export default function SubscriptionPurchase() {
|
|||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
onClick={() => setUseCustomDays(!useCustomDays)}
|
onClick={() => setUseCustomDays(!useCustomDays)}
|
||||||
|
role="switch"
|
||||||
|
aria-checked={useCustomDays}
|
||||||
|
aria-label={t('subscription.customDays.title')}
|
||||||
className={`relative h-6 w-10 rounded-full transition-colors ${
|
className={`relative h-6 w-10 rounded-full transition-colors ${
|
||||||
useCustomDays ? 'bg-accent-500' : 'bg-dark-600'
|
useCustomDays ? 'bg-accent-500' : 'bg-dark-600'
|
||||||
}`}
|
}`}
|
||||||
@@ -1346,6 +1349,9 @@ export default function SubscriptionPurchase() {
|
|||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
onClick={() => setUseCustomTraffic(!useCustomTraffic)}
|
onClick={() => setUseCustomTraffic(!useCustomTraffic)}
|
||||||
|
role="switch"
|
||||||
|
aria-checked={useCustomTraffic}
|
||||||
|
aria-label={t('subscription.customTraffic.selectVolume')}
|
||||||
className={`relative h-6 w-10 rounded-full transition-colors ${
|
className={`relative h-6 w-10 rounded-full transition-colors ${
|
||||||
useCustomTraffic ? 'bg-accent-500' : 'bg-dark-600'
|
useCustomTraffic ? 'bg-accent-500' : 'bg-dark-600'
|
||||||
}`}
|
}`}
|
||||||
|
|||||||
Reference in New Issue
Block a user