imaskjs
imaskjs copied to clipboard
Lazy focus mode
What problem you are trying to solve?
We're using imask as part of mui-like input component, it has placeholder displayed by default, and upon click moves it up and shows currency input.
https://github.com/uNmAnNeR/imaskjs/assets/136486874/379bdacd-4ca7-4a97-b6e9-61cfd8f07e2d
We'd like to use imask lazy=false
to display dollar sign when input is focused, and use lazy=true
when it's not.
https://github.com/uNmAnNeR/imaskjs/assets/136486874/13f50339-cce4-45a6-b6b8-bf46757d8c70
Describe the solution you'd like
We'd like to have lazy='focus'
mode, that enables lazy mode only when the input is focused, and can display native placeholder otherwise.
Describe alternatives you've considered
We considered exposing imask instance via imperative handle to parent component with manual control of onfocus/onblur, but we preserve ref
for external form validator so we cannot use it unfortunately.