Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions classes/views/shared/toggle.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -70,9 +78,7 @@
/>

<span class="frm_toggle" tabindex="0" role="switch"
<?php echo ! empty( $args['aria-label-attr'] ) ? 'aria-label="' . esc_attr( $args['aria-label-attr'] ) . '"' : ''; ?>
aria-labelledby="<?php echo esc_attr( $id ); ?>_label"
aria-checked="<?php echo esc_attr( $aria_checked ); ?>"
<?php FrmAppHelper::array_to_html_params( $aria_attrs, true ); ?>
>
<span class="frm_toggle_slider"></span>
</span>
Expand Down
Loading