fix(webui): pass aria-checked as a string literal on switch buttons
A11y checkers (axe-core / jsx-a11y) flag the boolean form because the ARIA spec defines aria-checked as the enum "true" | "false" | "mixed", not a boolean. React serialized the boolean to the right wire value at runtime, but the inspection layer keys off the JSX expression's static type. Switching to the explicit ternary silences both.
This commit is contained in:
@@ -372,7 +372,7 @@ function ToggleSwitch({ value, onChange, ariaLabel }: ToggleSwitchProps) {
|
||||
<button
|
||||
type="button"
|
||||
role="switch"
|
||||
aria-checked={value}
|
||||
aria-checked={value ? 'true' : 'false'}
|
||||
aria-label={ariaLabel}
|
||||
onClick={() => onChange(!value)}
|
||||
className={cn(
|
||||
|
||||
@@ -112,7 +112,7 @@ function ToggleSwitch({ value, onChange, ariaLabel }: ToggleSwitchProps) {
|
||||
<button
|
||||
type="button"
|
||||
role="switch"
|
||||
aria-checked={value}
|
||||
aria-checked={value ? 'true' : 'false'}
|
||||
aria-label={ariaLabel}
|
||||
onClick={() => onChange(!value)}
|
||||
className={cn(
|
||||
|
||||
Reference in New Issue
Block a user