ionic-framework icon indicating copy to clipboard operation
ionic-framework copied to clipboard

bug: vue: ion-input ignores the v-model.lazy modifier

Open averyrousseau opened this issue 2 weeks ago • 1 comments

Prerequisites

Ionic Framework Version

v9.x

Current Behavior

Ion-input doesn't appear to support Vue's lazy modifier on v-model: https://vuejs.org/guide/essentials/forms.html#modifiers The associated ref still updates on every keystroke, rather than on the change event.

Expected Behavior

With v-model.lazy, the connected ref should only update when the input is blurred.

Steps to Reproduce

  1. Go to: https://stackblitz.com/edit/duayqrjj?file=src%2Fcomponents%2FExample.vue Note v-model.lazy on both inputs.
  2. Enter any text in the ion-input. Note that the item underneath updates on every keystroke.
  3. Enter any text in the vanilla input. Note that the item underneath only updates when the input is blurred.

Code Reproduction URL

https://stackblitz.com/edit/duayqrjj?file=src%2Fcomponents%2FExample.vue

Ionic Info

N/A (see stackblitz)

Additional Information

This can be worked around by keeping the ref in sync manually:

<ion-input :value="inputValue" @ionChange="e => inputValue = e.target.value"></ion-input>

averyrousseau avatar Nov 17 '26 04:11 averyrousseau

Thanks for the report.

Verified on 9.0.12. For components, Vue applies the .trim and .number modifiers itself but leaves .lazy for the component to handle. The Vue wrapper for ion-input ignores it and always updates the bound value on ionInput, which fires on every keystroke. The same happens on ion-textarea, ion-searchbar, ion-input-otp and ion-range.

The workaround in your report works, also verified on 9.0.12. ionChange fires at the same moments as a native change event, on Enter or on blur after an edit:

<template>
  <ion-input label="Name" :value="name" @ionChange="name = $event.target.value"></ion-input>
</template>

<script setup lang="ts">
import { ref } from 'vue';
import { IonInput } from '@ionic/vue';

const name = ref('');
</script>

Tracked as a bug in @ionic/vue.

thetaPC avatar Nov 18 '26 18:11 thetaPC