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

Popover Closes When Content Changes #253

Closed
hfalucas opened this issue Apr 22, 2019 · 4 comments · May be fixed by ajesse11x/cms#3
Closed

Popover Closes When Content Changes #253

hfalucas opened this issue Apr 22, 2019 · 4 comments · May be fixed by ajesse11x/cms#3
Labels

Comments

@hfalucas
Copy link

Is there any way to prevent the popover to close when the content changes?

How to reproduce - jsfiddle

  • Click on the button and then click on the button inside the popover (the popover will close).
  • Click again on the button to open the popover and now click on the Add button inside of it. This time the popover won't close.
@Akryum
Copy link
Owner

Akryum commented Apr 22, 2019

My guess is that the element you clicked on is no longer considered a child of the popover (since it's removed from the DOM) so it thinks you clicked outside of the popover. Try setting :key="amount" on the last button to destroy it and create a new one when you click.

@hfalucas
Copy link
Author

hfalucas commented Apr 22, 2019

I guess you are right. Setting the same element (e.g div) where the v-if/v-else directives are applied without a key seems to solve it, Vue thinks its the same element and doesn't rerender and the popover doesn't seem to think it was clicked outside.

jsfiddle

There's no problem with this approach right?

Thanks in advance @Akryum :)

@Akryum
Copy link
Owner

Akryum commented Apr 22, 2019

Or you can try setting the same key on the buttons (and they should be at the same level in the root tree). But this still feel like a workaround, I wonder if we can somehow still consider the deleted elements as inside the popover.

@hfalucas
Copy link
Author

hfalucas commented Apr 23, 2019

I haven't dig in the code of this wrapper much, but that kind of functionality should probably be more related to the popper.js plugin itself no?

I believe this GH-193 solves this issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants