Skip to content

Invalid state for checkbox and radio#299

Merged
svenvandescheur merged 4 commits intomainfrom
feature/298-error-state-styling-checkbox-radio
Mar 10, 2026
Merged

Invalid state for checkbox and radio#299
svenvandescheur merged 4 commits intomainfrom
feature/298-error-state-styling-checkbox-radio

Conversation

@robinmolen
Copy link
Copy Markdown
Collaborator

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Feb 25, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.02%. Comparing base (fbab5f6) to head (14086e7).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #299      +/-   ##
==========================================
+ Coverage   91.96%   92.02%   +0.06%     
==========================================
  Files         203      203              
  Lines        8411     8426      +15     
  Branches     1251     1254       +3     
==========================================
+ Hits         7735     7754      +19     
+ Misses        673      669       -4     
  Partials        3        3              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Copy Markdown
Collaborator

@svenvandescheur svenvandescheur left a comment

Choose a reason for hiding this comment

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

Making this explicit in form fields seems sensible to me. A few remarks though:

  • Currenlty, formcontrol.scss does some higher lever trickery to set the red border. Do we we want to remove that in favor of this implementation?
  • I don't think this is implemented consistently with other form components (Select, Textarea).

@robinmolen robinmolen force-pushed the feature/298-error-state-styling-checkbox-radio branch 2 times, most recently from 540f1da to 15b2065 Compare March 3, 2026 14:08
@robinmolen
Copy link
Copy Markdown
Collaborator Author

I've removed the formcontrol invalid styling in favor of the input specific styling.

I've added design tokens for invalid input, select and textarea (along the previously added invalid design tokens for checkbox and radio). With that, i've removed the formcontrol.danger design token (this is replaced with the invalid input design token)

Each form component now explicitly has a invalid property, which sets their aria-invalid. Using aria-invalid en the :invalid css selector, the invalid styling is applied to all form fields.

In storybook, each form element has a invalid story displaying the invalid state.

As the formcontrol-danger token was used for input components, it makes more sense to have a `input-danger` token. To keep it consistent with the other "form input error state design tokens", it uses the modifier 'invalid'.

Also added design tokens for invalid select and textarea fields.
Added `invalid` property to Input, Checkboxgroup, Radiogroup, Choicefield, DatePicker, DateRangeInput, Select, Textarea, DateInput and Duration form components.

The `invalid` property is assigned to the html `aria-invalid` property, added aria context to the form component.
Added invalid styling for radio, checkbox, input, select en textarea components. Because the invalid styling is now applied at a form field level, the invalid styling on the formcontrol has been removed.

Realistically, an invalid radio or checkbox should be empty. But to ensure correct working and color contrasts in all scenarios, the styling also covers "filled in" states.
@robinmolen robinmolen force-pushed the feature/298-error-state-styling-checkbox-radio branch from 15b2065 to 14086e7 Compare March 10, 2026 13:09
@svenvandescheur svenvandescheur merged commit b9016bc into main Mar 10, 2026
9 checks passed
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.

Visual error state on checkbox and radio inputs

3 participants