Skip to content

Conversation

wenxi-onyx
Copy link
Member

@wenxi-onyx wenxi-onyx commented Aug 31, 2025

Description

  • Original issue: certain radios/checkboxes required users to click specifically just the box component

  • Nested labels cause text to not be clickable

  • Introduce htmlFor that associates html elements with the form input item using a unique id

  • CheckField.tsx had bugged logic that reset the form value on click

How Has This Been Tested?

  • locally

Backporting (check the box to trigger backport action)

Note: You have to check that the action passes, otherwise resolve the conflicts manually and tag the patches.

  • This PR should be backported (make sure to check that the backport attempt succeeds)
  • [Optional] Override Linear Check

@wenxi-onyx wenxi-onyx requested a review from a team as a code owner August 31, 2025 23:39
Copy link

vercel bot commented Aug 31, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
internal-search Error Error Sep 1, 2025 0:20am

Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

No issues found across 4 files

Copy link
Contributor

@evan-onyx evan-onyx left a comment

Choose a reason for hiding this comment

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

l e g e n d a r y

@wenxi-onyx wenxi-onyx merged commit f345da7 into main Sep 1, 2025
14 of 15 checks passed
@wenxi-onyx wenxi-onyx deleted the whuang/clickable-checkboxes-and-radios branch September 1, 2025 02:16
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

Greptile Summary

This PR fixes a critical UX/accessibility issue where checkbox and radio button labels were not clickable, forcing users to click precisely on the small form control elements instead of their associated text labels. The root cause was nested label elements and missing proper form association (htmlFor/id attributes).

The changes implement proper HTML form semantics across multiple UI components:

  1. CheckField.tsx: Fixed a logic bug where the onChange callback received the old value instead of the new toggled value, and added proper id/htmlFor association between the checkbox and its label
  2. Field.tsx: Completely restructured the BooleanFormField component to remove nested labels, added htmlFor prop to Label component, and generated stable unique IDs for form controls
  3. SettingsForm.tsx & CredentialFields.tsx: Replaced Label components with span elements to prevent nested label conflicts while maintaining styling
  4. E2E tests: Updated checkbox locators to use role-based selectors that align with the new accessible DOM structure

These changes ensure that clicking anywhere on a checkbox or radio button's label text will properly toggle the form control, significantly improving user experience and WCAG compliance. The implementation uses standard HTML form association patterns with id/htmlFor attributes to create the proper semantic relationship between labels and their corresponding inputs.

Confidence score: 3/5

  • This PR addresses important UX issues but has some implementation inconsistencies that could cause accessibility problems
  • Score reflects mixed quality of solutions - some files implement proper htmlFor/id associations while others just avoid the problem by removing labels
  • Pay close attention to CredentialFields.tsx which removes label association without adding proper id/htmlFor attributes

5 files reviewed, no comments

Edit Code Review Bot Settings | Greptile

AnkitTukatek pushed a commit to TukaTek/onyx that referenced this pull request Sep 23, 2025
* dont nest labels, use htmlfor, fix slackbot form bug

* fix playwright tests for improved labels
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