Skip to content

test(text-field): add gen2 a11y spec and dedicated VRT stories - #6797

Open
miwha-adobe wants to merge 6 commits into
miwha/swc-2323-text-field-migrationfrom
miwha/swc-2328-textfield-test
Open

miwha-adobe wants to merge 6 commits into
miwha/swc-2323-text-field-migrationfrom
miwha/swc-2328-textfield-test

Conversation

@miwha-adobe

@miwha-adobe miwha-adobe commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

Description

Test-only PR — no production code changes. Adds three test files that close out Phase 6 — Testing in the text-field migration plan:

  • test/text-field.a11y.spec.ts — Playwright ARIA snapshots for the textbox role, accessible name, and description across every labelling source, size, position, necessity indicator, prefix, and state; plus three keyboard checks against the delegatesFocus: true contract.
  • test/vrt/text-field.vrt.ts — one Permutations VRT story crossing sizes × label positions × necessity × states × anatomy × prefix × forced pseudo-states × wrapping × CJK, in light/ltr + dark/rtl, plus a ForcedColors variant. Includes a custom :host(:state(keyboard-focused)) mirror because the shared forcePseudoStates helper can't reach element-internals state.
  • test/vrt/text-field-custom-properties.vrt.ts — a CustomProperties VRT story that renders every documented --swc-* property and calls verifyCustomPropertyCoverage against the CEM, so any new property fails the story until it's covered.

Related issue(s)

  • Refs SWC-2328
  • Follows SWC-2327

Author's checklist

  • I have read the CONTRIBUTING and PULL_REQUESTS documents.
  • I have reviewed at the Accessibility Practices for this feature, see: Aria Practices
  • I have added automated tests to cover my changes.
  • I have included a well-written changeset if my change needs to be published. (Test-only.)
  • I have included updated documentation if my change required it. (Phase 6 boxes ticked in the migration plan.)

Reviewer's checklist

  • Includes a Github Issue with appropriate flag or Jira ticket number without a link
  • Includes thoughtfully written changeset if changes suggested include patch, minor, or major features
  • Automated tests cover all use cases and follow best practices for writing
  • Validated on all supported browsers
  • All VRTs are approved before the author can update Golden Hash

Manual review test cases

  • Playwright a11y spec runs green

    1. yarn build:gen2 && yarn workspace @adobe/spectrum-wc storybook:build
    2. yarn workspace @adobe/spectrum-wc test:a11y --grep "Text field"
    3. Expect all snapshots and keyboard tests pass.
  • VRT permutations render as expected

    1. Open Text field → Text field VRT → Permutations in Storybook.
    2. Confirm every row (sizes, positions, necessity, states, anatomy, prefix, forced hover/focus-visible, wrapping, CJK) renders in light/ltr and dark/rtl.
  • CEM coverage rejects gaps

    1. Add a throwaway --swc-text-field-* @cssproperty to the CEM.
    2. Open Text field → Text field VRT → CustomProperties and expect verifyCustomPropertyCoverage to throw. Revert.

Device review

  • Did it pass in Desktop?
  • Did it pass in (emulated) Mobile?
  • Did it pass in (emulated) iPad?

Accessibility testing checklist

  • Keyboard (required — document steps below)

    1. Open Text field → Overview. Press Tab; expect focus on the field with a visible ring and shadowRoot.activeElement === input (delegatesFocus).
    2. Type; expect the host value to reflect the input.
    3. Open Text field → States. Tab through the row; expect Tab to skip Disabled and Disabled + invalid, and to visit Read-only.
  • Screen reader (required — document steps below)

    1. Open Text field → Labelling with VoiceOver or NVDA. Tab to each field; expect "Email address, edit text" to be announced identically across the slot, accessible-label, and accessible-labelledby variants.
    2. Open Text field → States. Expect "required" on the required field (from the native attribute) and "invalid entry" + the error text on the invalid field via aria-describedby (no aria-errormessage — see the a11y migration analysis).
    3. Open Text field → Necessity indicator. Expect label mode to include "(required)" or "(optional)" in the name; icon mode announces only the label.

@changeset-bot

changeset-bot Bot commented Sep 24, 2026 •

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: a83f208

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@github-actions

Copy link
Copy Markdown
Contributor

📚 Branch Preview Links

🔍 Gen1 Visual Regression Test Results

When a visual regression test fails (or has previously failed while working on this branch), its results can be found in the following URLs:

Deployed to Azure Blob Storage: pr-6797

If the changes are expected, update the current_golden_images_cache hash in the circleci config to accept the new images. Instructions are included in that file.
If the changes are unexpected, you can investigate the cause of the differences and update the code accordingly.

@miwha-adobe
miwha-adobe force-pushed the miwha/swc-2328-textfield-test branch from eda42b4 to ce93d8a Compare September 24, 2026 15:34
@miwha-adobe miwha-adobe added Component:Textfield Status:Ready for review PR ready for review or re-review. gen2 These issues or PRs map to our 2nd generation work to modernizing infrastructure. High priority PR review PR is a high priority and should be reviewed ASAP labels Sep 24, 2026
@miwha-adobe
miwha-adobe marked this pull request as ready for review September 24, 2026 17:17
@miwha-adobe
miwha-adobe requested a review from a team as a code owner September 24, 2026 17:17

@nikkimk nikkimk 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.

I have some open questions about snapshots, but also I'm wondering if I should have included some a11y tests for the mixins.

@aramos-adobe aramos-adobe 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.

Going to create a PR that helps dedupe that mirrorKeyboardFocusedRules class text-field.vrt.ts

Comment thread gen2/packages/swc/components/text-field/test/vrt/text-field.vrt.ts Outdated
Comment thread gen2/packages/swc/components/text-field/test/vrt/text-field.vrt.ts
Comment thread gen2/packages/swc/components/text-field/test/text-field.test.ts
Base automatically changed from miwha/swc-2327-textfield-full-fidelity to miwha/swc-2323-text-field-migration September 29, 2026 15:29
@aramos-adobe
aramos-adobe force-pushed the miwha/swc-2328-textfield-test branch from 23b345c to 3b44708 Compare September 29, 2026 18:18
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@aramos-adobe
aramos-adobe force-pushed the miwha/swc-2328-textfield-test branch from 3b44708 to 33e4ab2 Compare September 29, 2026 18:27
Improve failure output for Storybook play-function assertions.
@aramos-adobe aramos-adobe added Status:Ready for re-review PR has had its feedback addressed and is once again ready for review. and removed Status:Ready for review PR ready for review or re-review. labels Sep 29, 2026
- Keep required-state verification on the input; Playwright rejects it in snapshots.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@rise-erpelding rise-erpelding self-assigned this Oct 2, 2026
@rise-erpelding
rise-erpelding self-requested a review October 2, 2026 15:06
Comment thread CONTRIBUTOR-DOCS/03_project-planning/03_components/text-field/migration-plan.md Outdated
Comment thread gen2/packages/swc/components/text-field/test/vrt/text-field.vrt.ts
Comment thread gen2/packages/swc/components/text-field/test/vrt/text-field.vrt.ts
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

@rise-erpelding rise-erpelding left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This is looking good! Noticed a few things on the custom properties VRT where custom properties aren't having an effect but permutations are looking great!

Comment thread gen2/packages/swc/components/text-field/test/vrt/text-field.vrt.ts

This branch has not been deployed

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

Labels

Component:Textfield gen2 These issues or PRs map to our 2nd generation work to modernizing infrastructure. High priority PR review PR is a high priority and should be reviewed ASAP Status:Ready for re-review PR has had its feedback addressed and is once again ready for review.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants