NumberField decrement converts negative to positive
- 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 setting `signDisplay` to `"never"`, ``'s decrement button converts negative values to positive, resulting in an incorrect post-decrement value
### 🤔 Expected Behavior?
Negative values should remain negative
### 😯 Current Behavior
Negative values are converted to positive
### 💁 Possible Solution
_No response_
### 🔦 Context
_No response_
### 🖥️ Steps to Reproduce
https://stackblitz.com/edit/vitejs-vite-xxqht6jk?file=src%2FApp.jsx
```jsx
import { useState } from 'react';
import {
NumberField,
Label,
Group,
Input,
Button,
} from 'react-aria-components';
function App() {
const [showSign, setShowSign] = useState(true);
const [value, setValue] = useState(0);
return (
<>
setShowSign(event.target.checked)}
/>
Show sign
Value: {value}
-
+
);
}
export default App;
```
To reproduce:
1. Set value to `0`
1. Check 'Show sign'
1. Decrement value twice
- Notice that value decrements in the negative direction correctly: `0` → `-1` → `-2`
1. Set value to `0`
1. Uncheck 'Show sign'
1. Decrement value twice
- Notice that value is not correctly decremented: `0` → `-1` → `0`
### Version
react-aria-components@1.12.1
### What browsers are you seeing the problem on?
Safari
### If other, please specify.
_No response_
### What operating system are you using?
macOS Tahoe 26.1
### 🧢 Your Company/Team
_No response_
### 🕷 Tracking Issue
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.