diff --git a/src/dayamlchecker/accessibility.py b/src/dayamlchecker/accessibility.py index e9e1144..15807fc 100644 --- a/src/dayamlchecker/accessibility.py +++ b/src/dayamlchecker/accessibility.py @@ -220,6 +220,8 @@ def _check_multifield_no_label_usage( findings: list[AccessibilityFinding] = [] for field in fields: + if "code" in field: + continue field_line = ( document_start_line + field.get("__line__", doc.get("__line__", 1)) - 1 ) diff --git a/tests/test_yaml_structure.py b/tests/test_yaml_structure.py index 3598c4b..0a9922a 100644 --- a/tests/test_yaml_structure.py +++ b/tests/test_yaml_structure.py @@ -573,6 +573,28 @@ def test_accessibility_no_label_false_does_not_count_as_label(self): f"Expected missing-label accessibility error, got: {errs}", ) + def test_accessibility_dynamic_code_field_no_error_on_multi_field_screen(self): + yaml_content = """id: court county +question: | + Court +fields: + - code: | + dynamic_fields() + - What is the court county?: court_county + choices: + - Contra Costa + - Alameda +""" + errs = find_errors_from_string( + yaml_content, + input_file="", + lint_mode="accessibility", + ) + self.assertFalse( + any("single-field screens" in e.err_str.lower() for e in errs), + f"Did not expect no-label accessibility error for dynamic code field, got: {errs}", + ) + def test_accessibility_tagged_pdf_info_for_docx_without_setting(self): yaml_content = """attachments: - name: Letter