react-spectrum icon indicating copy to clipboard operation
react-spectrum copied to clipboard

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

Open seanblue opened this issue 2 weeks ago โ€ข 0 comments

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

seanblue avatar Nov 21 '25 20:11 seanblue