adobe / adobe/react-spectrum

ComboBox doesn't validate controlled input

Open
#8,367 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
15.9k
Forks
1.6k
Avg merge
3d 9m
Merged PRs (30d)
59

Description

### Provide a general summary of the issue here

1. When `ComboBox` is used inside a `Form`
2. and if the `selectedKey` is `null`, but `inputValue` is given an invalid value
3. the enclosing `Form` doesn't validate that a key is selected

### 🤔 Expected Behavior?

1. When `ComboBox` is used inside a `Form`
2. and if the `selectedKey` is `null`, but `inputValue` is given an invalid value
3. the enclosing `Form` prevents submission of invalid value

### 😯 Current Behavior

as described in the summary

### 💁 Possible Solution

_No response_

### 🔦 Context

_No response_

### 🖥️ Steps to Reproduce

This is just a very simple reproduction. Pressing `submit` button will submit the form although no key is selected:

```tsx


Favorite Animal







Cat
Dog



Submit

```

### Version

"reac-aria-components": "^1.10.1",

### What browsers are you seeing the problem on?

Chrome

### If other, please specify.

_No response_

### What operating system are you using?

MacOS

### 🧢 Your Company/Team

_No response_

### 🕷 Tracking Issue

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.