RobinHerbots / Inputmask

Input Mask plugin
https://robinherbots.github.io/Inputmask/
MIT License
6.39k stars 2.17k forks source link

Maxlength behavior change #2707

Open weisborg opened 1 year ago

weisborg commented 1 year ago

I'm not liking the code for this build compared to previous either. Names of vars/methods are much less verbose usually being one char that doesn't describe what they do looking almost minified already. Makes it hard to track problems or hook to things like onBeforeWrite and such, and know what the params are. It wasn't what I expected either in that it provides cursor position, but buffer can only be modified on a blur event (And only a blur event inside the browser/document...anywhere else and the input shows like the buffer updated, but the input value is unmodified).

weisborg commented 1 year ago

The onBeforeWrite was kind of a side topic, hopefully that doesn't confuse the main post. We usually end up with a lot of masks that are like 99-999999, and they want the last number after the hyphen zero padded on the left. I was trying to dynamically update the entered value on the fly since I couldn't find a mask like that. I had designed JavaScript before where there was a single alpha followed by numbers and I tracked cursor pos putting a tab char in the string and added zeros then restored cursor pos. I updated the inputmask library to see if new functionality would allow it, but harder to follow the code then the maxlength issue happened.