question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Hide interactive tippy by clicking button inside content

See original GitHub issue

Hi! Help me please. I had made vue3 + vue-tippy dropdown component:

<tippy
        ref="tippyRef"
        animate-fill
        :arrow="false"
        :duration="[100, 50]"
        :interactive="true"
        :offset="offset"
        :placement="placement"
        theme="dropdown"
        trigger="click">
        <slot name="toggle">
            <AppBtn :variant="variant">
                {{ text }}
            </ZBtn>
        </slot>

        <template #content>
                <slot></slot>
        </template>
</tippy>

Question is: how can i close tippy when user clicks interactive element (buttons, links) inside <slot> content. ClickOutside is working but any presses inside #content are ignored

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
KABBOUCHIcommented, Jul 22, 2021

you can grab the hide method and execute it

<template #content="{ hide }" >
  <button @click="hide()">&times;</button>
</template>

using ur example:

<tippy interactive>
   <slot name="toggle">
      <AppBtn :variant="variant">
        {{ text }}
      </AppBtn>
   </slot>
   <template #content="{ hide }">
      <slot :hide="hide"></slot>
   </template>
</tippy>
// if u have only 1 slot
<Dropdown text="test" v-slot="{ hide }">
   <button @click="hide()">&times;</button>
   <button @click="hide()">&times;</button>
</Dropdown>

// if u have many slots
<Dropdown text="test">
 <template #default="{ hide }">
   <button @click="hide()">&times;</button>
   <button @click="hide()">&times;</button>
 </template>
</Dropdown>
1reaction
Lexpearthacommented, Jul 23, 2021

Upon further inspecting, it seems like whole object is an instance

Read more comments on GitHub >

github_iconTop Results From Across the Web

How do I hide TippyJS when element inside it is clicked?
I have to hide my tippy when an element inside it has been clicked (element is i.e. small images acting as links) but...
Read more >
Auto hide tooltip after being triggered with click. #531 - GitHub
Desired effect: After clicking a button a tooltip appears and then disappears automatically after x seconds without any input from user.
Read more >
All Props | Tippy.js - GitHub Pages
Prop Default Description plugins Specify plugins to use. See Plugins for details. role "tooltip" Specifies the role attribute on the tippy element. zIndex 9999 Determines the...
Read more >
All Props - VueTippy
Determines if the tippy has interactive content inside of it, so that it can be hovered over and clicked inside without hiding.
Read more >
Tippy.js - Tooltip and Popover Library
Interactivity. Tooltips can be interactive, allowing you to hover over and click inside them. Interactive. #HTML Content. Tooltips ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found