Closed johanneshayry closed 1 year ago
Additionally, when pasting a value, the full value is set to the server-side.
Regression from 073f3eb7b8d13370c008c5ba112cbc3cc17891fb when attaching Cleave.js to the underlying <input>
instead of the vaadin-text-field
element.
I've just checked and the same problem is still present in version 5.4.0. thanks for a workaround!
I guess an acceptable kludge would be to set the maxLength through this extension whenever a pattern is set. I have hard time to come up with another solution. If Cleave.js is attached to the vaadin-text-field the value property is correctly set, but the caret jumps around. If Cleave.js is attached to the underlying input element, the caret works, but (of course) the input value changes are not observed by the Vaadin web component.
Phone number formatting has the same issue. Also, there is o way to set the max length because the allowed length depends on the country of the phone number.
At least with custom blocks if you keep writing characters after the maximum number of characters, the latest keypress is appended to the visible value.
Let's say you have a formatter that forces three blocks 'X-XX-XXX'. If you write 123456789 you will get a visible value
1-23-456
, but the server-side value is1-23-4569
.Not a nice workaround is to call
setMaxLength
for the TextField.