Comments (7)
from react-number-format.
Well actually on second though, I would say that the expected behavior is to delete a digit every time Detete or Backspace is pressed, like so:
Current State | Key pressed | Expected |
---|---|---|
`USD 1 | ,500` | Backspace |
`USD 1, | 500` | Backspace |
`USD | 500` | Backspace |
`USD 1 | ,500` | Delete |
`USD 1, | 500` | Delete |
This could be implemented by registering an handler onKeyDown
to handle event.keyCode
8 (for Backspace) and 46 (for Delete).
What do you think @s-yadav?
from react-number-format.
Yes I have done the same fix. Will push it with some other changes.
from react-number-format.
Somehow I feel, it's better to have your first case (that is just changing the cursor position). The second case seems visually wrong and confuses (at least to me).
from react-number-format.
@mquandalle Can you cross check version 1.1.0-alpha or branch 1.1.0-alpha.
from react-number-format.
Version 1.1.0-alpha looks good to me (I've just read to code, not tested yet).
About my second suggestion, maybe this could be an option? At least in French, when the group delimiter is a blank space, moving the cursors doesn't make much sense.
from react-number-format.
Moving cursor does not feel very odd, but deleting a character not near to cursor feels odd, mainly when doing backspace, and behaviour of backspace and delete should be same just on other direction.
Lets keep the first case. Anyway as long user is able to delete we are ok.
from react-number-format.
Related Issues (20)
- NumericFormat suffix is not allowing antdesign input to handle suffix HOT 1
- Support IME japanese keyboard HOT 2
- Not able to delete negative sign using backspace button HOT 1
- Intl.NumberFormat with fraction digits. input box <=> form state mismatch HOT 2
- percentage formatting, input box <=> form state mismatch
- Controlled Input will convert -0 to 0 HOT 2
- Problem with default value doesnt override mask, but add this value to end mask HOT 1
- Package should not throw errors when `thousandSeparator` and `decimalSeparator` are similar
- Caret moved at the end when used with Ant Design library HOT 2
- The caret position isn't set properly when I use the `removeFormatting` function to use the Persian numbers with the `thousandSeparator` prop HOT 3
- Removing last number with trailing zeros deletes all the right side zeros, when integrating with `react-hook-form` HOT 5
- TypeError: Cannot read property 'length' of undefined, js engine: hermes
- Decimal rounding up HOT 3
- Caret focus in empty place with format value HOT 3
- Type error preventing app from deploying 'No inputs were found in config file '.../node_modules/react-number-format/tsconfig.json'. HOT 2
- Why NumericFormat is not working with react-hook-form refs? HOT 1
- Weird behaviour when using different IMEs with thousand seperator
- About when to show suffix behavior
- Negative values are displayed with - instead of − and so isn't read out correctly by all screen readers
- onValueChange function changes entered digit to 0 after 16th digits HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-number-format.