taiga-family/maskito

๐Ÿž - `Number` has problems with multi-character prefix (if initial value is empty)

nicoasp opened this issue ยท 1 comments

Which package(s) are the source of the bug?

@maskito/kit

Playground Link

https://stackblitz.com/edit/vdrb7k-yhybpb?file=mask.ts

Description

The bug happens when using maskitoNumberOptionsGenerator with a prefix with at least 4 characters, for example "EUR ".
What happens then is, if you try to type one of the prefix characters, you get a strange result with the prefix characters in strange order. Eg type "U" => "URE"

Screenshot 2023-10-13 at 20 46 22

Maskito version

1.7.0

Which browsers have you used?

  • Chrome
  • Firefox
  • Safari
  • Edge

Which operating systems have you used?

  • macOS
  • Windows
  • Linux
  • iOS
  • Android

Thanks for clarifying the title. Sorry I did not have enough time to do a deeper analysis of in which conditions exactly this happens.
One additional point: the issue also happens for the postfix.
FYI, in my application what I'm doing for now as a workaround is removing any prefix and postfix characters from the start and end of the elementState.value in a preprocessor I put before all others. This works fine for me for my specific range of possible prefixes/postfixes, and the full prefix/postfix gets added again in a postprocessor provided by maskitoNumberOptionsGenerator.