adobe / adobe/react-spectrum

NumberField should not allow spaces for percents or currencies that don't use spaces

Open
#9,225 1 comment 1 reaction 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

When using `NumberField`, some keypresses are blocked if they are not relevant. For example, you cannot enter letters. However, spaces are allowed. From my understanding, spaces only make sense when using `unit` since there will be a space between the number and the unit (and certain currencies), so they should probably be blocked in other cases.

### 🤔 Expected Behavior?

Spaces / spacebar presses should be blocked when the formal style does not allow spaces, such as `unit` and certain currencies like USD. That said, maybe spacebar presses shouldn't be allowed in any situation since the space is automatically inserted with the unit (or currency like `EUR`) without the user needed to do so themselves.

### 😯 Current Behavior

Spaces can be entered into a `NumberField`

### 💁 Possible Solution

_No response_

### 🔦 Context

_No response_

### 🖥️ Steps to Reproduce

Using a `NumberField` with USD currency, press the spacebar to insert spaces.
Most weirdly is when you replace the input contents with only spaces, clicking outside the input replaces the text instead of just removing the spaces to make it blank.

### Version

3.44.0

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

Microsoft Edge

### If other, please specify.

_No response_

### What operating system are you using?

Windows

### 🧢 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.