From 276926a5e2b743a00e8e1766ebf8dbd571ced2d1 Mon Sep 17 00:00:00 2001 From: "vivi-the-going-merry[bot]" <308115520+vivi-the-going-merry[bot]@users.noreply.github.com> Date: Thu, 24 Sep 2026 06:01:31 -0600 Subject: [PATCH 1/5] Add regression test for GDPR disabled-notice dangling aria-labelledby --- tests/phpunit/fields/test_FrmFieldGdpr.php | 58 ++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 tests/phpunit/fields/test_FrmFieldGdpr.php diff --git a/tests/phpunit/fields/test_FrmFieldGdpr.php b/tests/phpunit/fields/test_FrmFieldGdpr.php new file mode 100644 index 0000000000..55c85b1632 --- /dev/null +++ b/tests/phpunit/fields/test_FrmFieldGdpr.php @@ -0,0 +1,58 @@ +set_current_user_to_1(); + FrmAppHelper::get_settings()->enable_gdpr = false; + + $html = $this->render_gdpr_field( 543 ); + + $this->assertStringNotContainsString( + 'aria-labelledby', + $html, + 'The disabled-notice branch has no element carrying the referenced id, so aria-labelledby should not be printed.' + ); + $this->assertStringContainsString( 'GDPR field is disabled', $html ); + } + + /** + * @covers FrmFieldGdpr::include_front_form_file + */ + public function test_enabled_field_still_has_aria_labelledby() { + FrmAppHelper::get_settings()->enable_gdpr = true; + + $html = $this->render_gdpr_field( 544 ); + + $this->assertStringContainsString( 'aria-labelledby="frm-gdpr-accept-544"', $html ); + $this->assertStringContainsString( 'id="frm-gdpr-accept-544"', $html ); + } + + /** + * @param int $field_id + * + * @return string + */ + private function render_gdpr_field( $field_id ) { + $field_type = new FrmFieldGdpr( + array( + 'id' => $field_id, + 'gdpr_agreement_text' => 'I agree', + 'value' => '', + ) + ); + + return $field_type->include_front_field_input( + array( + 'html_id' => 'field_gdpr_' . $field_id, + 'field_name' => 'item_meta[' . $field_id . ']', + ), + array() + ); + } +} From 0d719e9aa259084e42995d2cf05592d1650641eb Mon Sep 17 00:00:00 2001 From: "vivi-the-going-merry[bot]" <308115520+vivi-the-going-merry[bot]@users.noreply.github.com> Date: Thu, 24 Sep 2026 06:06:01 -0600 Subject: [PATCH 2/5] Drop dangling aria-labelledby from GDPR disabled-notice branch No element in that branch carries the referenced id, so the ARIA reference had no accessible name to point to. --- classes/views/frm-fields/front-end/gdpr/gdpr-field.php | 2 +- tests/phpunit/fields/test_FrmFieldGdpr.php | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/classes/views/frm-fields/front-end/gdpr/gdpr-field.php b/classes/views/frm-fields/front-end/gdpr/gdpr-field.php index 0339677907..e5f80e0fe7 100644 --- a/classes/views/frm-fields/front-end/gdpr/gdpr-field.php +++ b/classes/views/frm-fields/front-end/gdpr/gdpr-field.php @@ -26,7 +26,7 @@ -
+