Subscribe on changes!

v-if bugs when used inside of label+button construction

avatar
Mar 20th 2023

This issue is not caused by VUE and can also exist when not using a framework.

avatar
Mar 20th 2023

This issue is not caused by VUE and can also exist when not using a framework.

Can you please give me an example? I thought this is because click on the div with v-if in this example causes click initiated from label because for some reason label doesn't count this div as a part of the button (just like if I click on the label itself outside of the button)

avatar
Mar 20th 2023

It seems that if label element wrap a button element which wrap a div element with v-if, that div element will be added a eventListener uncorrectly. It's weird.

avatar
Mar 21st 2023

a workaround: @click.prevent="toggle"

avatar
Mar 21st 2023

This issue is not caused by VUE and can also exist when not using a framework.

Can you please give me an example? I thought this is because click on the div with v-if in this example causes click initiated from label because for some reason label doesn't count this div as a part of the button (just like if I click on the label itself outside of the button)

image