Skip to content

feat(ui): Add thousands separator formatting to item amount input#90

Open
Acc-Off wants to merge 1 commit intoCommunityOx:mainfrom
Acc-Off:feature/inventory_control_input_format
Open

feat(ui): Add thousands separator formatting to item amount input#90
Acc-Off wants to merge 1 commit intoCommunityOx:mainfrom
Acc-Off:feature/inventory_control_input_format

Conversation

@Acc-Off
Copy link
Copy Markdown

@Acc-Off Acc-Off commented Mar 16, 2026

Summary

Replace the type="number" input with a type="text" input for the item
amount field in InventoryControl, and apply comma-separated thousands
formatting (e.g. 1,000, 10,000) using toLocaleString('en-us').

Changes

  • Changed input type from number to text
  • Format the entered value with thousands separators on each keystroke
  • Preserve cursor position after formatting using useRef and useEffect
  • Strip non-numeric characters before dispatching the value to the Redux store

Motivation

The default number input does not display thousand separators, making it
difficult to read large quantities at a glance. This change improves
readability without affecting the underlying numeric value stored in state.

Testing

  • Type a large number (e.g. 1000000) and verify it displays as 1,000,000
  • Verify the cursor does not jump to the end while editing mid-value
  • Verify that the dispatched amount is correct (no commas included)
  • Verify that empty input resets the amount to 0

Demo

ox_inventory

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