Skip to content

fix: update ComboBox validate type for selection mode generic and null value#9742

Open
lixiaoyan wants to merge 2 commits intoadobe:mainfrom
lixiaoyan:fix/combobox-validate-type
Open

fix: update ComboBox validate type for selection mode generic and null value#9742
lixiaoyan wants to merge 2 commits intoadobe:mainfrom
lixiaoyan:fix/combobox-validate-type

Conversation

@lixiaoyan
Copy link
Contributor

@lixiaoyan lixiaoyan commented Mar 5, 2026

Summary

  • ComboBoxProps was using Validation<ComboBoxValidationValue> without passing the M (selection mode) generic through. Fixed by changing to Validation<ComboBoxValidationValue<M>> so multi-select mode gets the correct Key[] type for value.
  • ValidationType<'single'> resolved to Key but the validate function can be called with null when no item is selected (e.g. with allowsCustomValue). Updated to Key | null to match the runtime behavior.

Test plan

  • yarn check-types passes with no new errors
  • Verify that ComboBox with selectionMode="multiple" has correctly typed value field (Key[]) in the validate callback
  • Verify that single-select ComboBox validate callback correctly types value as Key | null

🤖 Generated with Claude Code

lixiaoyan and others added 2 commits March 5, 2026 17:24
ComboBoxProps was using `Validation<ComboBoxValidationValue>` without
passing the `M` generic, so the validate callback's `value` field was
always typed as `Key` (single mode) even with `selectionMode="multiple"`.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Since ComboBox supports allowsCustomValue, the validate function can be
called with an empty selection in single mode. Update ValidationType to
include null for single selection to match the runtime behavior.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@lixiaoyan lixiaoyan changed the title fix: pass selection mode generic to ComboBox validate type fix: update ComboBox validate type for selection mode generic and null value Mar 5, 2026
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.

1 participant