Skip to content

fix(fields): let users clear an optional select - #1520

Merged
jordividaller merged 2 commits into
mainfrom
fix/clear-optional-select
Oct 14, 2026
Merged

jordividaller merged 2 commits into
mainfrom
fix/clear-optional-select

Conversation

@jordividaller

@jordividaller jordividaller commented Oct 12, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Optional dropdowns can now be cleared. Before, once a value was picked there was no way to go back to empty.

Why

In some forms (for example the visa / work permit dropdown in the France administrative details step) the field is optional, but picking a value could not be undone. That value also reveals other fields, so users could get stuck with fields they no longer wanted.

The schema already marks these fields as optional, so the fix belongs in the default component.

What changed

Toggle details
  • The default select shows a small clear button when the field is not required and has a value. Required fields are unchanged.
  • Clearing sets the field to an empty string, like clearing a text field. undefined would make the form fall back to the saved value when editing an existing record.
  • A number-typed select no longer turns an empty value into 0 when cleared.
  • No change to the public API surface. New class for styling: RemoteFlows__SelectField__Clear.
  • Date pickers and radio groups are intentionally left out: no optional case for them yet.

Screenshots

N/A

Related Resources

N/A

Testing

Unit tests cover that a required select shows no clear button and that an optional select can be cleared back to empty, including one prefilled from saved values.

  • Tested against the example/ app in a browser
  • Feature flag: N/A

🤖 Generated with Claude Code


Note

Low Risk
Localized form-field UX and value-coercion fix with tests; no API or auth/data-path changes.

Overview
Optional select fields can be reset to empty via a clear control on the default select UI when the field is not required and has a value; required selects are unchanged. Clearing writes an empty string (so edited records do not snap back to saved values) and returns focus to the select trigger.

The shared SelectField wrapper no longer coerces a cleared value to Number('') / 0 for number-typed JSON schema fields. Unit tests cover required vs optional behavior and prefilled optional values.

Reviewed by Cursor Bugbot for commit 35894f1. Bugbot is set up for automated code reviews on this repo. Configure here.

Optional dropdowns had no way back to empty once a value was picked. The
default select now shows a clear button when the field is not required.
Clearing writes an empty string, since undefined made react-hook-form fall
back to the saved default value, and a number-typed select no longer casts
the empty value to 0.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

📦 Bundle Size Report

Metric Current Previous Change Status
Total (gzip) 230.76 kB 230.55 kB +213 B (+0.1%) 🔴
Total (raw) 642.57 kB 642.09 kB +473 B (+0.1%) 🔴
CSS (gzip) 21.95 kB 21.94 kB +8 B (+0.0%) 🔴
CSS (raw) 114.51 kB 114.43 kB +84 B (+0.1%) 🔴

Size Limits

  • ✅ Total gzipped: 230.76 kB / 350 kB (65.9%)
  • ✅ Total raw: 642.57 kB / 850 kB (75.6%)
  • ✅ CSS gzipped: 21.95 kB / 25 kB (87.8%)

Largest Files (Top 5)

  1. index.esm-wIkXrqU6.js - 11.4 kB (0 B (0%))
  2. styles.css - 10.97 kB (+4 B (+0.0%))
  3. index.css - 10.97 kB (+4 B (+0.0%))
  4. internals-BOZceErx.js - 6.13 kB (new)
  5. hooks-ThU7CDLI.js - 5.85 kB (0 B (0%))
View All Files (291 total)
File Size (gzip) Change
index.esm-wIkXrqU6.js 11.4 kB 0 B (0%)
styles.css 10.97 kB +4 B (+0.0%)
index.css 10.97 kB +4 B (+0.0%)
internals-BOZceErx.js 6.13 kB new
hooks-ThU7CDLI.js 5.85 kB 0 B (0%)
sdk.gen-BRPiw4M1.js 5.58 kB 0 B (0%)
index.js 5.51 kB -2 B (-0.0%)
flows/Onboarding/hooks.js 4.67 kB 0 B (0%)
utils-CUgvJHl4.js 4.07 kB 0 B (0%)
FieldSetField-D0HdSLTs.js 4.04 kB new

✅ Bundle size check passed

@github-actions

Copy link
Copy Markdown
Contributor

📊 Coverage Report

✅ Coverage increased! 🎉

Metric Current Previous Change Status
Lines 89.53% 89.53% 0% ⚪
Statements 89.41% 89.40% 0% ⚪
Functions 88.41% 88.41% 0% ⚪
Branches 81.17% 81.14% +0.03% 🟢

Detailed Breakdown

Lines Coverage
  • Covered: 5387 / 6017
  • Coverage: 89.53%
  • Change: 0% (2 lines)
Statements Coverage
  • Covered: 5452 / 6098
  • Coverage: 89.41%
  • Change: 0% (2 statements)
Functions Coverage
  • Covered: 1427 / 1614
  • Coverage: 88.41%
  • Change: 0% (1 functions)
Branches Coverage
  • Covered: 3345 / 4121
  • Coverage: 81.17%
  • Change: +0.03% (6 branches)

✅ Coverage check passed

@github-actions

github-actions Bot commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Deploy preview for adp-cost-calculator ready!

Project:adp-cost-calculator
Status: ✅  Deploy successful!
Preview URL:https://adp-cost-calculator-p87xl6wdw-remotecom.vercel.app
Latest Commit:35894f1

Deployed with vercel-action

@github-actions

github-actions Bot commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Deploy preview for remote-flows ready!

Project:remote-flows
Status: ✅  Deploy successful!
Preview URL:https://remote-flows-2e4mupenv-remotecom.vercel.app
Latest Commit:35894f1

Deployed with vercel-action

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 15ab676. Configure here.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@jordividaller
jordividaller merged commit 8aab71c into main Oct 14, 2026
10 of 11 checks passed
@jordividaller
jordividaller deleted the fix/clear-optional-select branch October 14, 2026 16:31
@gabrielseco gabrielseco mentioned this pull request Oct 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants