fix(amount) : borne le curseur restauré lors d'un rejet maxLength
This commit is contained in:
@@ -201,7 +201,7 @@ const onInput = (event: Event) => {
|
|||||||
// maxLength borne la longueur du MODÈLE (pas l'affichage) : on ignore le keystroke en dépassement.
|
// maxLength borne la longueur du MODÈLE (pas l'affichage) : on ignore le keystroke en dépassement.
|
||||||
if (props.maxLength != null && model.length > Number(props.maxLength)) {
|
if (props.maxLength != null && model.length > Number(props.maxLength)) {
|
||||||
target.value = formattedValue.value
|
target.value = formattedValue.value
|
||||||
const restored = Math.max(0, caret - 1)
|
const restored = Math.min(Math.max(0, caret - 1), formattedValue.value.length)
|
||||||
target.setSelectionRange(restored, restored)
|
target.setSelectionRange(restored, restored)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user