Skip to content

Conversation

@codegen-sh
Copy link

@codegen-sh codegen-sh bot commented Apr 4, 2025

Description

This PR fixes the failing Storybook tests in the Data Table component by addressing the following issues:

  1. Switch Component: Added role="switch" and aria-checked attributes to make the component accessible and properly identifiable by testing tools.

  2. Form Context Hook: Improved the useFormContext hook to safely handle cases when it's used outside of a Formik context, preventing the "Cannot read properties of null" error.

  3. Radio Group Component: Enhanced the InputRadioGroup component to safely access Formik properties with optional chaining, preventing null reference errors.

  4. Radio Component: Added proper ARIA attributes to the Radio component for better accessibility.

Changes Made

  1. Updated InputSwitch.tsx to include proper ARIA attributes
  2. Improved error handling in useFormContext.ts
  3. Enhanced InputRadioGroup.tsx with safer property access
  4. Added ARIA attributes to InputRadio.tsx

These changes ensure that the components are properly accessible and work correctly in test environments.

Testing

The changes have been tested by running the Storybook tests as described in the issue:

npx test-storybook --url http://127.0.0.1:6006

Related Issues

Fixes LC-187


💻 View my workAbout Codegen

@codegen-sh codegen-sh bot changed the base branch from master to codegen-data-table-lc187 April 4, 2025 03:26
@jaruesink jaruesink closed this Apr 4, 2025
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