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

Don't show multiple tooltips at once in a generated list of tooltips #52

Closed
danchristian opened this issue Jul 5, 2018 · 6 comments
Closed

Comments

@danchristian
Copy link

I have a list generated by Vue and each item contains a tooltip, however currently I can open 2 at the same time when clicked. Ideally if one is open and you open another one, the first would close. The demos on tippy.js seem correct in this behaaviour and it seems that multiple: false, is set as the default in the options, so not sure what I'm doing wrong?

button(
  @click.stop, 
  v-show="withdrawal.CommentsList.length > 1",
  v-tippy="{ html: '#comments', trigger : 'click', interactive: true, reactive : true}")
ol(id="comments")
  li(v-for="comment in comments") {{ Comment }}

Default State:
screen shot 2018-07-05 at 14 56 29

State after both buttons clicked:
screen shot 2018-07-05 at 14 56 40

@KABBOUCHI
Copy link
Owner

KABBOUCHI commented Jul 5, 2018

When you use reactive option (reserve event listeners), you only can use 1 html/component element per tippy instance

image

Can you setup a small demo so i can fix it or modify your codes? (https://codesandbox.io/s/vue or github repo)

@danchristian
Copy link
Author

danchristian commented Jul 6, 2018

I have created a demo here https://codesandbox.io/s/z6my0n2p13 and have realised it is the @click.stop that is causing the behaviour. The button to open the tooltip is within an <li> which itself is selectable, that is why I am using @click.stop on the tooltip button, othwerwise it selects the parent <li>.

I guess I could make the tooltips react on hover, rather than click as a tempoary workaround. Unless there is another way?

@KABBOUCHI
Copy link
Owner

u can add @mouseleave="($event) => $event.target._tippy.hide()"

https://codesandbox.io/s/yyx92969

@danchristian
Copy link
Author

That then means you can't interact with the tooltip as when you leave the button it closes it.

@KABBOUCHI
Copy link
Owner

maybe you can manage tippy instances like this https://codesandbox.io/s/82kz5m06k9 ?

@danchristian
Copy link
Author

Thank you for your help and apologies for not replying. I gave the sample code a go but in the end have stuck with a hover interaction instead of a click to keep things simple.

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

No branches or pull requests

2 participants