Skip to content

fix(F0Checkbox): stability audit BLOCKING fixes#3899

Open
eliseo-juan wants to merge 1 commit intofix/stability-shared-checkboxfrom
fix/stability-3872-f0checkbox
Open

fix(F0Checkbox): stability audit BLOCKING fixes#3899
eliseo-juan wants to merge 1 commit intofix/stability-shared-checkboxfrom
fix/stability-3872-f0checkbox

Conversation

@eliseo-juan
Copy link
Copy Markdown
Contributor

Summary

Applies all BLOCKING findings from stability audit issue #3872.

  • Export CheckboxProps interface publicly so consumers can type-check against it
  • Fix StoryObj type to use typeof meta (not typeof F0Checkbox)
  • Add withSnapshot import and Snapshot story export
  • Rename __test__/__tests__/ to match F0 conventions
  • Fix screen import from @/testing/test-utils (not @testing-library/react)
  • Add 4 missing unit tests: indeterminate aria-checked="mixed", required asterisk visible, name prop accepted, onCheckedChange called with false on uncheck

Related

Quality gate

  • pnpm tsc --noEmit
  • pnpm lint
  • pnpm vitest:ci src/components/F0Checkbox ✅ (18/18 passing)

- Export CheckboxProps interface publicly
- Fix StoryObj type to use typeof meta
- Add withSnapshot import and Snapshot story
- Rename __test__ to __tests__ (convention)
- Fix screen import to use @/testing/test-utils
- Add tests: indeterminate aria-checked=mixed, required asterisk,
  name prop acceptance, onCheckedChange false on uncheck
@eliseo-juan eliseo-juan requested a review from a team as a code owner April 8, 2026 16:12
Copilot AI review requested due to automatic review settings April 8, 2026 16:12
@github-actions github-actions bot added the fix label Apr 8, 2026
@github-actions github-actions bot added the react Changes affect packages/react label Apr 8, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Applies stability-audit BLOCKING fixes for F0Checkbox, focusing on public typing, Storybook correctness, snapshot coverage, and missing unit tests.

Changes:

  • Export CheckboxProps from F0Checkbox for consumer type-checking.
  • Fix Storybook StoryObj typing and add a Snapshot story using withSnapshot.
  • Update tests (including screen import source) and add new cases for indeterminate/required/name/onCheckedChange behaviors.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
packages/react/src/components/F0Checkbox/F0Checkbox.tsx Exports CheckboxProps publicly (per conventions) but still allows unnamed checkbox rendering.
packages/react/src/components/F0Checkbox/tests/F0Checkbox.test.tsx Adds missing tests and updates imports; some new assertions/selectors are too weak/broad to guarantee correct behavior.
packages/react/src/components/F0Checkbox/stories/F0Checkbox.stories.tsx Fixes StoryObj typing to use typeof meta and adds Snapshot story + withSnapshot import.
Comments suppressed due to low confidence (3)

packages/react/src/components/F0Checkbox/F0Checkbox.tsx:11

  • The PR description/issue states all BLOCKING stability-audit findings are fixed, but title is still optional and there’s no alternative accessible name prop. This allows rendering a checkbox with no visible label and no aria-label, which results in an unnamed control for assistive tech. Consider making title required, or adding/forwarding an explicit aria-label/aria-labelledby API (and/or a dev-only warning when neither is provided).
export interface CheckboxProps extends DataAttributes {
  /**
   * The title of the checkbox
   */
  title?: string

packages/react/src/components/F0Checkbox/tests/F0Checkbox.test.tsx:189

  • This test is labeled as forwarding required to the checkbox element, but it only checks for any [aria-hidden="true"] node in the whole document. That selector is too broad and can pass for unrelated elements, and it doesn’t validate the required indicator is tied to this checkbox. Prefer asserting the * inside the checkbox’s label (e.g., scope with within(label)), and/or adjust the test name to reflect that it’s verifying the required asterisk rendering rather than attribute forwarding.
    packages/react/src/components/F0Checkbox/tests/F0Checkbox.test.tsx:196
  • The name prop test currently only asserts that rendering does not throw, so it doesn’t actually cover that name is applied/forwarded. Since the underlying checkbox root sets a name attribute, assert it on the rendered element (e.g., getByRole('checkbox') has name="my-checkbox") to provide real coverage.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 8, 2026

📦 Alpha Package Version Published

Use pnpm i github:factorialco/f0#npm/alpha-pr-3899 to install the package

Use pnpm i github:factorialco/f0#17473f636f14488cfe51d7e033ec0f8c0c6179e5 to install this specific commit

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 8, 2026

🔍 Visual review for your branch is published 🔍

Here are the links to:

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 8, 2026

Coverage Report for packages/react

Status Category Percentage Covered / Total
🔵 Lines 45.42% 11169 / 24588
🔵 Statements 44.67% 11515 / 25776
🔵 Functions 37.16% 2510 / 6753
🔵 Branches 37.4% 7344 / 19635
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
packages/react/src/components/F0Checkbox/F0Checkbox.tsx 100% 100% 100% 100%
Generated in workflow #12668 for commit 6e1377e by the Vitest Coverage Report Action

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

Labels

fix react Changes affect packages/react

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants