Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: v7 vue v-model not updating until input is blurred #26700

Closed
4 of 8 tasks
MimyyK opened this issue Jan 30, 2023 · 5 comments
Closed
4 of 8 tasks

bug: v7 vue v-model not updating until input is blurred #26700

MimyyK opened this issue Jan 30, 2023 · 5 comments
Labels
package: vue @ionic/vue package type: bug a confirmed bug report

Comments

@MimyyK
Copy link

MimyyK commented Jan 30, 2023

Prerequisites

Ionic Framework Version

  • v4.x
  • v5.x
  • v6.x
  • v7.x
  • Nightly

Current Behavior

Hello,
I have a question about v7-beta with Vue, I did a test and it seems that the v-model doesn't work like before (v6.5.1).
With v6.5.1, when the user is writing in a ion-input it was updating my variable directly, with v7-beta, the user has to leave the field in order to update my variable.

If I replace v-model with :value="myFieldValueOnInput" @input="event => myFieldValueOnInput = event.target.value" it works.

Here is a video to see the current behavior:

ionic-v7-test.mov

It leads to undesired behavior from my point of view where a user have to leave the input focus to get the expected behavior from the form (when I want to know if my form is valid):

ionic-v7-test-project.mov

Expected Behavior

I'm not sure if this is a bug, maybe it's an expected change? But it seems to me that the v-model should update my variable.

Steps to Reproduce

  • Open the Vue devtools
  • Enter text in the field with v-model without leaving the field -> you can see in the devtools that the variable is not updated
  • Click outside the field -> you can see in the devtools that the variable is now updated

Code Reproduction URL

https://github.com/MimyyK/test-ionic-v7

Ionic Info

Ionic:

Ionic CLI : 6.20.6
Ionic Framework : @ionic/vue 7.0.0-beta.0

Capacitor:

Capacitor CLI : 4.6.2
@capacitor/android : not installed
@capacitor/core : 4.6.2
@capacitor/ios : not installed

Utility:

cordova-res : not installed globally
native-run : 1.7.1

System:

NodeJS : v18.12.1
npm : 9.2.0
OS : macOS

Additional Information

No response

@ionitron-bot ionitron-bot bot added the triage label Jan 30, 2023
@liamdebeasi liamdebeasi self-assigned this Jan 30, 2023
@liamdebeasi
Copy link
Contributor

Thanks for the report. I can reproduce this bug. The problem here is we need to listen for ionInput to update the v-model binding instead of ionChange. We updated ionChange to only fire when the value of the input is committed by the user (via a blur) in order to align with <input />. I will work on a fix for this.

@liamdebeasi liamdebeasi added package: vue @ionic/vue package type: bug a confirmed bug report labels Jan 30, 2023
@liamdebeasi liamdebeasi removed their assignment Jan 30, 2023
@ionitron-bot ionitron-bot bot removed the triage label Jan 30, 2023
@liamdebeasi liamdebeasi changed the title bug: v7 vue v-model bug: v7 vue v-model not updating until input is blurred Jan 30, 2023
@liamdebeasi
Copy link
Contributor

Here is a dev build with a proposed fix if you are interested in testing:

npm install @ionic/vue@7.0.0-dev.11677608949.16e25264 @ionic/vue-router@7.0.0-dev.11677608949.16e25264

@MimyyK
Copy link
Author

MimyyK commented Mar 1, 2023

Hello,
Thanks for the fix, it works well! 👍🏻

@liamdebeasi
Copy link
Contributor

Thanks for the issue. This has been resolved via #26876, and a fix will be available in an upcoming release of Ionic Framework.

@ionitron-bot
Copy link

ionitron-bot bot commented Apr 1, 2023

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.

@ionitron-bot ionitron-bot bot locked and limited conversation to collaborators Apr 1, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
package: vue @ionic/vue package type: bug a confirmed bug report
Projects
None yet
Development

No branches or pull requests

2 participants