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 Report][3.0.0] VSwitch only outputs every second toggle #15666

Closed
tve opened this issue Aug 22, 2022 · 3 comments
Closed

[Bug Report][3.0.0] VSwitch only outputs every second toggle #15666

tve opened this issue Aug 22, 2022 · 3 comments
Assignees
Labels
C: VSelectionControl C: VSwitch VSwitch T: bug Functionality that does not work as intended/expected

Comments

@tve
Copy link

tve commented Aug 22, 2022

Environment

Vuetify Version: 3.0.0-beta.8
Vue Version: 3.2.36
Browsers: Chrome 102.0.5005.149
OS: Linux x86_64

Steps to reproduce

  • open the codepen
  • click on the switch, observe the brief "ON" label to indicate output event
  • observe that the switch hasn't toggled due to disconnect between output event and modelValue prop
  • click on the switch again, observe that no output event is produced (the label doesn't flash "ON")
  • click on the switch more often and observe that only every second click results in an event

Expected Behavior

I expected an output even on every click

Actual Behavior

Only every second click produces an output event

Reproduction Link

https://codepen.io/codesurfr/pen/NWYJyPV

Other comments

The intent here is to process and validate the switch output before feeding it back such that the switch only toggles visually IF the action it is intended to cause actually took place. I.e., if the user clicks the switch and the external action doesn't occur, then the switch doesn't change position.

@KaelWD KaelWD added T: bug Functionality that does not work as intended/expected C: VSwitch VSwitch C: VSelectionControl and removed S: triage labels Aug 22, 2022
@KaelWD KaelWD added this to the v3.0.x milestone Aug 22, 2022
@nekosaur
Copy link
Member

nekosaur commented Aug 23, 2022

This could be a bit tricky, since vue does not support controlled inputs the same way react does. vuejs/core#6084

Since our v-switch is backed by an <input>, it gets checked even though the model hasn't changed.

@tve
Copy link
Author

tve commented Nov 1, 2022

I updated the codepen to the 3.0.0 release, problem still exists.

@tve tve changed the title [Bug Report][3.0.0-beta.8] VSwitch only outputs every second toggle [Bug Report][3.0.0] VSwitch only outputs every second toggle Nov 1, 2022
@KaelWD KaelWD modified the milestones: v3.0.x, v3.1.x Jan 6, 2023
@johnleider
Copy link
Member

You can't use @update:modelValue and not update the model https://codepen.io/johnjleider/pen/rNZRmZg

If you have any questions, please reach out to us in our Discord community.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C: VSelectionControl C: VSwitch VSwitch T: bug Functionality that does not work as intended/expected
Projects
None yet
Development

No branches or pull requests

4 participants