Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
ca9cb12
Add aria-describedby attribute where missing for fields with error
AbdiTolesa Nov 10, 2025
603d9b1
Cover remaining fields that miss aria-describedby when field errors
AbdiTolesa Nov 10, 2025
60c34ef
Remove aria-describedby atts from elements with no errors
AbdiTolesa Nov 10, 2025
39cf3ed
Try fixing Workflow errors
AbdiTolesa Nov 11, 2025
32c726c
Try fixing Workflow errors
AbdiTolesa Nov 11, 2025
2058760
Try fixing Workflow errors
AbdiTolesa Nov 11, 2025
e1970fb
Fix warnings
AbdiTolesa Nov 18, 2025
272d808
Fix static analysis warning
AbdiTolesa Nov 18, 2025
b6faf96
Make sure frm_include_alert_role_on_field_errors can be used to remov…
AbdiTolesa Nov 20, 2025
4bed2cd
Fix condition check to remove role='alert'
AbdiTolesa Nov 20, 2025
ec5d850
Correct check for role='alert' in an html
AbdiTolesa Nov 20, 2025
4482d15
Improve code reliability
AbdiTolesa Nov 21, 2025
74f8a6c
Ignore PHPStan false positive
AbdiTolesa Nov 21, 2025
2b43dd8
Remove PHPStan ignore line to suppress warning
AbdiTolesa Nov 21, 2025
4228669
Reuse existing variable
AbdiTolesa Nov 28, 2025
5234a55
Undo last change
AbdiTolesa Nov 28, 2025
f81936d
Merge branch 'master' into issue-6068-fix_checkbox_and_radio_buttons_…
Crabcyborg Dec 1, 2025
d09ccd1
Merge branch 'master' into issue-6068-fix_checkbox_and_radio_buttons_…
Crabcyborg Dec 1, 2025
d2c44e5
Fix potential bug and workflow errors
AbdiTolesa Dec 2, 2025
02d6728
Commit before merge
AbdiTolesa Dec 2, 2025
4a70eaa
Fix potential bug and workflow errors
AbdiTolesa Dec 2, 2025
adc91f5
Fix invalid function return statement
AbdiTolesa Dec 2, 2025
92a69e9
Resolve conflict with master
AbdiTolesa Dec 2, 2025
09febfe
Resolve conflict with master
AbdiTolesa Dec 2, 2025
9a43d8d
Resolve conflict with master
AbdiTolesa Dec 2, 2025
2f40d11
Fix all merge conflicts
AbdiTolesa Dec 2, 2025
81c1f09
Fix all merge conflicts
AbdiTolesa Dec 2, 2025
2f7b19b
Fix remaining merge conflict
AbdiTolesa Dec 2, 2025
10a587d
Build files
AbdiTolesa Dec 2, 2025
ce3b9c6
Use attribut tokenization to implement set/unset aria-describedby
AbdiTolesa Dec 2, 2025
80d9070
Fix merge conflict
AbdiTolesa Dec 2, 2025
58e1328
Merge branch 'master' into issue-6068-fix_checkbox_and_radio_buttons_…
Crabcyborg Dec 3, 2025
933de3f
Go back to using $add_html
Crabcyborg Dec 3, 2025
ee00f36
Go back to using $html and unset $add_html
Crabcyborg Dec 3, 2025
e9ce506
Simplify js code further
AbdiTolesa Dec 3, 2025
9208e5a
Merge branch 'issue-6068-fix_checkbox_and_radio_buttons_accessibility…
AbdiTolesa Dec 3, 2025
eaf7d0e
Return early when there are no errors
AbdiTolesa Dec 3, 2025
86ed330
Move out logic in foreach block into a new function
AbdiTolesa Dec 4, 2025
a428c47
Fix FrmFieldFormHtml.php blank_line_before_statement rule
AbdiTolesa Dec 4, 2025
1360c0b
Possible php cs fixer fix
Crabcyborg Dec 4, 2025
90d084e
Merge branch 'master' into issue-6068-fix_checkbox_and_radio_buttons_…
Crabcyborg Dec 4, 2025
e26b042
Filter out empty ariaDescribedBy values
AbdiTolesa Dec 4, 2025
732cde4
Merge branch 'issue-6068-fix_checkbox_and_radio_buttons_accessibility…
AbdiTolesa Dec 4, 2025
02e8f58
Fix merge conflict and merge master
AbdiTolesa Dec 4, 2025
6b1c15c
Make sure ariaDescribedBy attribute is set when error occurs in JS va…
AbdiTolesa Dec 4, 2025
d6bf75e
Fix all eslint errors
AbdiTolesa Dec 4, 2025
8962fd3
Merge branch 'master' into issue-6068-fix_checkbox_and_radio_buttons_…
Crabcyborg Dec 8, 2025
e4c79ba
Merge branch 'master' into issue-6068-fix_checkbox_and_radio_buttons_…
Crabcyborg Dec 8, 2025
4e7bf1f
Make sure aria-describedby is set when using ajax submission
AbdiTolesa Dec 9, 2025
c55910d
Merge master
AbdiTolesa Dec 9, 2025
c728c84
Merge branch 'master' into issue-6068-fix_checkbox_and_radio_buttons_…
Crabcyborg Dec 11, 2025
6feac4f
Merge branch 'master' into issue-6068-fix_checkbox_and_radio_buttons_…
Crabcyborg Jan 5, 2026
31960b6
Trim value before comparison check
AbdiTolesa Jan 6, 2026
4e652e4
Fix merge conflicts
AbdiTolesa Jan 6, 2026
966aabe
Add missing space before parenth
AbdiTolesa Jan 6, 2026
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
13 changes: 10 additions & 3 deletions classes/controllers/FrmFieldsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -546,13 +546,20 @@ public static function input_html( $field, $echo = true ) {
self::add_pattern_attribute( $field, $add_html );

$add_html = apply_filters( 'frm_field_extra_html', $add_html, $field );
$add_html = ' ' . implode( ' ', $add_html ) . ' ';
$html = ' ' . implode( ' ', $add_html ) . ' ';

unset( $add_html );

if ( isset( $field['args'] ) ) {
$field_object = FrmFieldFactory::get_field_type( FrmField::get_field_type( $field ), $field );
$field_object->add_aria_description( $field['args'], $html );
}
Comment thread
coderabbitai[bot] marked this conversation as resolved.

if ( $echo ) {
echo $add_html; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
echo $html; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
}

return $add_html;
return $html;
}

/**
Expand Down
15 changes: 13 additions & 2 deletions classes/models/FrmFieldFormHtml.php
Original file line number Diff line number Diff line change
Expand Up @@ -286,16 +286,27 @@ private function replace_error_shortcode() {
$this->maybe_add_error_id();
$error = $this->pass_args['errors'][ 'field' . $this->field_id ] ?? false;

if ( ! empty( $error ) && ! str_contains( $this->html, 'role="alert"' ) && FrmAppHelper::should_include_alert_role_on_field_errors() ) {
if ( empty( $error ) ) {
FrmShortcodeHelper::remove_inline_conditions( false, 'error', $error, $this->html );

return;
}
Comment thread
AbdiTolesa marked this conversation as resolved.

$include_alert_role_on_field_errors = FrmAppHelper::should_include_alert_role_on_field_errors();
Comment thread
AbdiTolesa marked this conversation as resolved.
$has_alert_role = str_contains( $this->html, 'role="alert"' );

if ( ! $has_alert_role && $include_alert_role_on_field_errors ) {
$error_body = self::get_error_body( $this->html );

if ( is_string( $error_body ) && ! str_contains( $error_body, 'role=' ) ) {
$new_error_body = preg_replace( '/class="frm_error/', 'role="alert" class="frm_error', $error_body, 1 );
$this->html = str_replace( '[if error]' . $error_body . '[/if error]', '[if error]' . $new_error_body . '[/if error]', $this->html );
}
} elseif ( ! $include_alert_role_on_field_errors && $has_alert_role ) {
$this->html = str_replace( 'role="alert"', '', $this->html );
}
Comment thread
coderabbitai[bot] marked this conversation as resolved.

FrmShortcodeHelper::remove_inline_conditions( ! empty( $error ), 'error', $error, $this->html );
FrmShortcodeHelper::remove_inline_conditions( true, 'error', $error, $this->html );
Comment thread
Crabcyborg marked this conversation as resolved.
}

/**
Expand Down
5 changes: 3 additions & 2 deletions classes/models/fields/FrmFieldType.php
Original file line number Diff line number Diff line change
Expand Up @@ -1537,16 +1537,17 @@ protected function get_field_input_html_hook( $field ) {
}

/**
* Link input to field description for screen readers
* Link input to field description for screen readers.
*
* @since 3.0
* @since x.x Function privacy changed from `protected` to `public`.
*
* @param array $args
* @param string $input_html
*
* @return void
*/
protected function add_aria_description( $args, &$input_html ) {
public function add_aria_description( $args, &$input_html ) {
$aria_describedby_exists = preg_match_all( '/aria-describedby=\"([^\"]*)\"/', $input_html, $matches ) === 1;

$describedby = $aria_describedby_exists ? preg_split( '/\s+/', esc_attr( trim( $matches[1][0] ) ) ) : array();
Expand Down
9 changes: 9 additions & 0 deletions classes/views/frm-fields/front-end/checkbox-field.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@
* Extra line breaks show as space on the front-end when
* the form is double filtered and not minimized.
*
* @var array $field
* @var string $field_name
* @var bool $read_only
* @var string $html_id
* @var array|null $args
*
* @phpcs:disable Generic.WhiteSpace.ScopeIndent
*/

Expand Down Expand Up @@ -68,6 +74,9 @@
?><input type="checkbox" name="<?php echo esc_attr( $field_name ); ?>[<?php echo esc_attr( $other_opt ? $opt_key : '' ); ?>]" id="<?php echo esc_attr( $html_id ); ?>-<?php echo esc_attr( $opt_key ); ?>" value="<?php echo esc_attr( $field_val ); ?>"<?php
echo $checked . ' '; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped

if ( isset( $args ) ) {
$field['args'] = $args;
}
do_action( 'frm_field_input_html', $field );

if ( 0 === $option_index && FrmField::is_required( $field ) ) {
Expand Down
7 changes: 6 additions & 1 deletion classes/views/frm-fields/front-end/dropdown-field.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,12 @@
if ( $read_only ) {
?>
<select <?php do_action( 'frm_field_input_html', $field ); ?>>
<?php } else { ?>
<?php
} else {
if ( isset( $args ) ) {
$field['args'] = $args;
}
?>
<select name="<?php echo esc_attr( $field_name ); ?>" id="<?php echo esc_attr( $html_id ); ?>" <?php do_action( 'frm_field_input_html', $field ); ?>>
Comment thread
AbdiTolesa marked this conversation as resolved.
<?php
}
Expand Down
10 changes: 10 additions & 0 deletions classes/views/frm-fields/front-end/radio-field.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@
* Extra line breaks show as space on the front-end when
* the form is double filtered and not minimized.
*
* @var array $field
* @var string $field_name
* @var bool $read_only
* @var string $html_id
* @var array|null $args
*
* @phpcs:disable Generic.WhiteSpace.ScopeIndent
*/

Expand Down Expand Up @@ -56,6 +62,10 @@
<input type="radio" name="<?php echo esc_attr( $field_name ); ?>" id="<?php echo esc_attr( $html_id . '-' . $opt_key ); ?>" value="<?php echo esc_attr( $field_val ); ?>"
<?php
echo $checked . ' '; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped

if ( isset( $args ) ) {
$field['args'] = $args;
}
do_action( 'frm_field_input_html', $field );
?>/><?php

Expand Down
Loading
Loading