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

Elements with a v-if tag are not evaluated as a descendant. #14

Open
astarrh opened this issue Jun 20, 2021 · 5 comments
Open

Elements with a v-if tag are not evaluated as a descendant. #14

astarrh opened this issue Jun 20, 2021 · 5 comments
Labels
bug Something isn't working

Comments

@astarrh
Copy link

astarrh commented Jun 20, 2021

It seems that anything located in or beneath an element using v-if is disqualified from inheritance.

    <div v-click-away="doAction"> 

        <div id="worksFine">
              DivContent
        </div>

        <div id='disqualified' v-if="someFlag === true">
            This still triggers "doAction" (even with someFlag set to true)
        </div>

    </div>

This was happening in my custom directive as well. It seems that v-if breaks .contains() in some way.

@aralzaim7
Copy link

We had the same issue, we found the work around by using v-show instead of v-if tags

@VinceG VinceG added the bug Something isn't working label Jul 23, 2021
@VinceG
Copy link
Owner

VinceG commented Jul 23, 2021

@astarrh @aralzaim7 Can you try removing this return and see if that works

https://github.com/VinceG/vue-click-away/blob/master/index.js#L37

@astarrh
Copy link
Author

astarrh commented Jul 23, 2021

@VinceG Sorry, I'm having trouble replicating this issue now. The example I pasted is working fine for me when I try to re-implement it.

@TheAustinG
Copy link

@VinceG I ran into this same issue. I removed the return as you suggested and it seems to work as expected now.

@soloviofff
Copy link

It can be solved by

<div
        v-click-away="closeSomething"
        @click.stop
    >
    <div v-if="someThing"></div>
</div>

Or use v-show

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants