diff --git a/classes/views/shared/toggle.php b/classes/views/shared/toggle.php index 477e0ffb62..a4afa12813 100644 --- a/classes/views/shared/toggle.php +++ b/classes/views/shared/toggle.php @@ -25,6 +25,14 @@ $input_html = $args['input_html'] ?? array(); $use_container = false; +$aria_attrs = array(); +if ( ! empty( $args['aria-label-attr'] ) ) { + $aria_attrs['aria-label'] = $args['aria-label-attr']; +} else { + $aria_attrs['aria-labelledby'] = $id . '_label'; +} +$aria_attrs['aria-checked'] = $aria_checked; + $div_params = array( // This is important when the default style is !important as Pro styling may cause conflicts. // It uses --toggle-on-color so just set the variable. @@ -70,9 +78,7 @@ /> - aria-labelledby="_label" - aria-checked="" + >