Skip to content

fix(checkable-inputs): switch role, onChange without name, disabled precedence - #682

Open
blvdmitry wants to merge 5 commits into
fix/form-control-a11yfrom
fix/checkable-inputs
Open

blvdmitry wants to merge 5 commits into
fix/form-control-a11yfrom
fix/checkable-inputs

Conversation

@blvdmitry

Copy link
Copy Markdown
Contributor

Summary

PR 2 of the Phase −1 bug-fix stack.

  • Switch role (Switch/Switch.tsx): added role="switch" to the native checkbox. aria-checked isn't set, because the native checked state already exposes it. oxlint's role-has-required-aria-props doesn't know that, so there's a scoped disable comment with the reason.
  • onChange without name (HiddenInput/HiddenInput.tsx): removed the if (!name) return guard. Checkbox, Radio and HiddenInput now call onChange when no name is passed. name comes through as "" to match the ChangeHandler type.
  • disabled precedence (HiddenInput/HiddenInput.tsx): ?? became ||, matching Checkbox and Radio. FormControl disabled={false} no longer re-enables a disabled group or input.

Tests:

  • Switch.stories.tsx now queries getByRole("switch").
  • New HiddenInput.stories.tsx stories: test: onChange without name and test: disabled precedence.
  • All of these fail on the base branch and pass here.

Related Issue

Phase −1 of the headless-extraction plan.

Screenshots / Recordings

No visual changes.

Notes for Reviewers

  • This PR is stacked on fix(form-control): wire FormControl attributes into all form fields #681 (fix/form-control-a11y).
  • Results: pnpm lint passes. pnpm test:browser has 609 passing and 1 failing, Image > onLoad, which fails on main too in this sandbox because it has no network access.
  • An earlier commit on this branch was pushed before lint ran. The second commit fixes the lint warning.

Generated by Claude Code

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

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants