Skip to content
This repository is currently being migrated. It's locked while the migration is in progress.

[Do not merge - Protoype] Accessibility test data structure - #5703

Closed
amyleadem wants to merge 87 commits into
mainfrom
5291-a11y-test-pilot
Closed

[Do not merge - Protoype] Accessibility test data structure#5703
amyleadem wants to merge 87 commits into
mainfrom
5291-a11y-test-pilot

Conversation

@amyleadem

@amyleadem amyleadem commented Feb 11, 2026

Copy link
Copy Markdown
Collaborator

Warning

The work in this PR has been moved to #6118. This PR is now outdated, but can still be used for historical reference for generated component tests.

Summary

Early stage exploration into creating common component tests that can be shared for component-specific testing.

This is a work in progress and should not be merged.

Demo links

This PR also introduces a new copilot prompts to generate and edit component tests.

Related Issue

If this PR resolves an open issue, please add the issue number here.

Related to #5727

Preview Environment Links

Open Preview Environment

Copilot AI review requested due to automatic review settings February 11, 2026 14:27

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces an early prototype for storing and displaying reusable accessibility test definitions (“test library”) and per-component test results, with an initial implementation for the va-link component.

Changes:

  • Adds a shared include to render accessibility test results and emit JSON test data for client-side use.
  • Introduces an accessibility test library YAML and a sample component-specific results YAML for va-link.
  • Adds a new “Accessibility Tests” sub-page and links to it from the Link component docs.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 11 comments.

Show a summary per file
File Description
src/_includes/accessibility-test-results.html New include that renders test results UI and outputs component test data as JSON.
src/_data/accessibility_tests/va-link.yml Initial sample test results data for the Link component, including a summary block.
src/_data/accessibility_tests/test-library.yml New shared catalog of tests, subtests, and environment lists by category.
src/_components/link/index.md Adds an “Accessibility Tests” sub-page entry and links to the new results page.
src/_components/link/accessibility-tests.md New component sub-page that includes the test results include for va-link.

Comment thread src/_includes/accessibility-test-results.html Outdated
Comment thread src/_includes/accessibility-test-results.html Outdated
Comment thread src/_includes/accessibility-test-results.html Outdated
Comment thread src/_includes/accessibility-test-results.html Outdated
Comment thread src/_data/accessibility_tests/test-library.yml Outdated
Comment thread src/_includes/accessibility-test-results.html Outdated
Comment on lines +89 to +120
{% for test in component_tests.tests %}
{% assign test_def = nil %}
{% assign parent_def = nil %}

{% comment %} First, try to find as a top-level test {% endcomment %}
{% assign test_def = test_library | where: "id", test.id | first %}

{% comment %} If not found, search through subtests {% endcomment %}
{% unless test_def %}
{% for parent in test_library %}
{% if parent.subtests %}
{% for subtest in parent.subtests %}
{% if subtest.id == test.id %}
{% assign test_def = subtest %}
{% assign parent_def = parent %}
{% break %}
{% endif %}
{% endfor %}
{% endif %}
{% if test_def %}
{% break %}
{% endif %}
{% endfor %}
{% endunless %}

{% if test_def %}
{% comment %} Use parent category if this is a subtest {% endcomment %}
{% if parent_def %}
{% assign test_category = parent_def.category %}
{% else %}
{% assign test_category = test_def.category %}
{% endif %}

Copilot AI Feb 11, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test-definition lookup pattern (where by id, then nested scan of subtests) is repeated in multiple places in this include. Besides being hard to keep consistent, it re-scans the full test library for each test. Consider precomputing an id→definition index in data (or via a helper include) so each test is resolved once.

Suggested change
{% for test in component_tests.tests %}
{% assign test_def = nil %}
{% assign parent_def = nil %}
{% comment %} First, try to find as a top-level test {% endcomment %}
{% assign test_def = test_library | where: "id", test.id | first %}
{% comment %} If not found, search through subtests {% endcomment %}
{% unless test_def %}
{% for parent in test_library %}
{% if parent.subtests %}
{% for subtest in parent.subtests %}
{% if subtest.id == test.id %}
{% assign test_def = subtest %}
{% assign parent_def = parent %}
{% break %}
{% endif %}
{% endfor %}
{% endif %}
{% if test_def %}
{% break %}
{% endif %}
{% endfor %}
{% endunless %}
{% if test_def %}
{% comment %} Use parent category if this is a subtest {% endcomment %}
{% if parent_def %}
{% assign test_category = parent_def.category %}
{% else %}
{% assign test_category = test_def.category %}
{% endif %}
{% comment %}
Precompute an index of all tests (including subtests) keyed by id,
with the effective category (parent category for subtests).
{% endcomment %}
{% assign test_index = "" | split: "" %}
{% for lib_test in test_library %}
{% assign index_entry = {"id": lib_test.id, "category": lib_test.category} %}
{% assign test_index = test_index | push: index_entry %}
{% if lib_test.subtests %}
{% for subtest in lib_test.subtests %}
{% assign sub_index_entry = {"id": subtest.id, "category": lib_test.category} %}
{% assign test_index = test_index | push: sub_index_entry %}
{% endfor %}
{% endif %}
{% endfor %}
{% for test in component_tests.tests %}
{% comment %}
Look up the test definition (or subtest) from the precomputed index
using the test id. This avoids rescanning the full test library for
each component test.
{% endcomment %}
{% assign test_def = test_index | where: "id", test.id | first %}
{% if test_def %}
{% assign test_category = test_def.category %}

Copilot uses AI. Check for mistakes.
<h2>Test Summary</h2>


{% if component_tests.size > 0 %}

Copilot AI Feb 11, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

component_tests is a map (it contains keys like component, variants, tests, summary), so component_tests.size > 0 will be true even when there are no tests. This check should be against component_tests.tests (and its size) instead.

Suggested change
{% if component_tests.size > 0 %}
{% if component_tests.tests and component_tests.tests.size > 0 %}

Copilot uses AI. Check for mistakes.
Comment thread src/_includes/accessibility-test-results.html Outdated
Comment thread src/_includes/accessibility-test-results.html Outdated
Copilot AI review requested due to automatic review settings February 11, 2026 15:26

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 10 out of 10 changed files in this pull request and generated 13 comments.

Comment thread src/_data/accessibility_tests/test-library/1-perceivable.yml Outdated
<p class="vads-u-color--gray-dark vads-u-font-size--sm vads-u-margin-top--2">
<strong>Last Updated:</strong> {{ summary.last_updated | date: "%B %d, %Y" }}
</p>
{% endif %}

Copilot AI Feb 11, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The second "Test Summary" section (lines 356-378) is placed inside the wrong conditional block. It's currently inside the "if component_tests.size > 0" block that starts at line 189, but it appears after the category loop ends at line 354. However, looking at the structure, the closing "{% endif %}" at line 379 closes the block from line 189, and then line 380 has an "{% else %}" that doesn't have a matching opening condition. This suggests a logic error in the conditional structure. The summary dashboard should likely be at the same level as the test categories section, not nested within it.

Suggested change
{% endif %}

Copilot uses AI. Check for mistakes.
Comment thread src/_includes/accessibility-test-results.html Outdated
Comment thread src/_includes/accessibility-test-results.html Outdated
Comment thread src/_includes/accessibility-test-results.html Outdated
Comment thread src/_includes/accessibility-test-results.html Outdated
Comment thread src/_includes/accessibility-test-results.html Outdated
Comment thread src/_data/accessibility_tests/test-library/1-perceivable.yml Outdated
Comment thread src/_includes/accessibility-test-results.html Outdated
Comment thread src/_includes/accessibility-test-results.html Outdated
@amyleadem amyleadem linked an issue Feb 11, 2026 that may be closed by this pull request
1 task
Copilot AI review requested due to automatic review settings February 11, 2026 22:12

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 12 out of 12 changed files in this pull request and generated 10 comments.

Comment thread src/_data/accessibility_tests/test-library/1-perceivable.yml Outdated
Comment thread src/_includes/accessibility-test-results.html Outdated
Comment thread src/_includes/accessibility-test-results.html Outdated
Comment thread src/_includes/accessibility-test-results.html Outdated
Comment thread src/_includes/accessibility-test-results.html Outdated
Comment thread src/_data/accessibility_tests/test-library/_config.yml Outdated
Comment thread src/_includes/accessibility-test-results.html Outdated
Comment thread src/_data/accessibility_tests/va-link.yml Outdated
Comment thread src/_components/card/card-status/accessibility-tests.md
Copilot AI review requested due to automatic review settings February 12, 2026 23:14
amyleadem added a commit that referenced this pull request Apr 10, 2026
@amyleadem

Copy link
Copy Markdown
Collaborator Author

Closing this in favor of the publishable MVP work in #6118

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Accessibility audit: Create a list of common WCAG tests

4 participants