Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: Add an aria-label and aria-checked #52

Open
wit03 opened this issue Oct 9, 2024 · 0 comments
Open

refactor: Add an aria-label and aria-checked #52

wit03 opened this issue Oct 9, 2024 · 0 comments

Comments

@wit03
Copy link
Member

wit03 commented Oct 9, 2024

          _:hammer_and_wrench: Refactor suggestion_

Consider enhancing accessibility and error handling.

The overall structure of the component is well-implemented, following React and TypeScript best practices. However, there are a couple of areas where we could improve:

  1. Accessibility: The component could benefit from additional ARIA attributes to enhance screen reader support.
  2. Error Handling: The current implementation doesn't show how errors from the handleChangeApplicationCategory function are handled.

Here are some suggestions to address these points:

  1. Enhance accessibility:

    • Add an aria-label to the Disclosure.Button:
      <Disclosure.Button
        aria-label="Toggle application category filter"
        // ... other props
      >
    • Add aria-checked attribute to the Checkbox component:
      <Checkbox
        // ... other props
        aria-checked={checkBox.applicationCategory.includes(item.name)}
      />
  2. Improve error handling:

    • Consider wrapping the handleChangeApplicationCategory call in a try-catch block:
      onChange={(e: React.ChangeEvent<HTMLInputElement>) => {
        try {
          handleChangeApplicationCategory(e.target.value);
        } catch (error) {
          console.error('Failed to update application category:', error);
          // Optionally, update some error state here
        }
      }}

These changes will improve the component's robustness and accessibility.

Originally posted by @coderabbitai[bot] in #46 (comment)

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

No branches or pull requests

1 participant