parttio / textfieldformatter

TextField Formatter Vaadin add-on
Apache License 2.0
13 stars 9 forks source link

Pasting value may drop information without user noticing #72

Open juuso-vaadin opened 3 months ago

juuso-vaadin commented 3 months ago

Example 1

Field with formatting NumeralFieldFormatter(",", ".", 2) will format

Example 2

Field with formatting CustomStringBlockFormatter.Builder().blocks(3, 3, 3).delimiters("-") will format

Example 3

Field with formatting IBANFormatter.fromIBANLength(18) will format

Improvement idea

As generic solution, component should recognize if inputted characters are cut out. This is mainly an issue when pasting in values. Component could also indicate if user is trying to type in a field that has already reached the max number of characters.

juuso-vaadin commented 2 months ago

Here's a sample for small wiggle animation that could indicate that field cannot accept input. This can be due to max limit reached or trying to enter a character that is not allowed. https://codepen.io/juuso-vaadin/pen/QWXLErW

jcgueriaud1 commented 2 months ago

After investigation, the javascript library cleave.js doesn't give any hook or any solution to see if the value has been stripped or not.

That would require to change the javascript and that doesn't seem to be easy to do.