Hi, when using a NumeralFieldFormatter for a TextField with decimal separat

Hi, when using a NumeralFieldFormatter for a TextField with decimal separator ‘,’ and thousands separator ‘.’, I see the following behavior with Vaadin 14.1.19 and TextField Formatter 4.2.0:

  1. Enter “4,5” in the field. This is OK.
  2. Set the focus in front of the input and add some numbers, e.g. to enter “1234,5”.
  3. Observation: in the moment when the Formatter adds the “.” and shows “1.234,5” then the focus in the input field is set to the end.
  4. I guess that this behavior is because the JavaScript code replaces the content of the input field by a formatted version.
  5. Is it possible (and if so then how) to keep the focus where it is or set it back to where it was, while correcting a number in the beginning/in the middle?

I can see the issue. This does not happen at least with the latest version of Cleave.js. I can try to update the dependency. It might have been fixed there. Otherwise, it’s how I’m doing the integration.

The problem is in my integration. I opened an issue https://github.com/johannesh2/textfieldformatter/issues/26

Great, thanks! :-)