Tippyjs: Tippy is showing and hiding immediately

Created on 18 Apr 2018  路  3Comments  路  Source: atomiks/tippyjs

Latest version of Tippy (2.5). Kind of in a hurry so I haven't been able to create a CodePen. Tippy is showing and hiding immediately. Here's the code I'm using:

tippy(ref, {
  trigger: 'manual',
  interactive: true,
  delay: [0, 2000],
  duration: 2000,
  animation: 'fade',
  onShow(instance) {
    console.log('showing')
  },
  onHide(instance) {
    console.log('hiding')
  },
  updateDuration: 350
})

this.secretKeyReference.on('success', () => {
  ref._tippy.show(2000)
})

When I trigger the callback, here's what appears in the console:

screen shot 2018-04-18 at 7 01 06 am

As you can see, the callbacks are triggered instantly. What am I doing wrong here?

Most helpful comment

@Aka4Code It's the global click event listener for the hideOnClick option.

Use setTimeout(() => tippy.show()) to run it after the click listener has executed.

This catches many people off guard so I will make a prominent note in the docs about it soon. And I'm 100% sure it's the OP's problem too.

All 3 comments

Something must be triggering hide() on the next animation frame, I'd guess (~16ms)?

Without a CodePen I don't think I can help :s

Is it happening with previous versions?

@atomiks here example: https://jsfiddle.net/vL5bafx2/

  • same as @divmgl , don't know whats triggering hide()

@Aka4Code It's the global click event listener for the hideOnClick option.

Use setTimeout(() => tippy.show()) to run it after the click listener has executed.

This catches many people off guard so I will make a prominent note in the docs about it soon. And I'm 100% sure it's the OP's problem too.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

faroukcharkas picture faroukcharkas  路  4Comments

dariadomagala picture dariadomagala  路  5Comments

madjennsy picture madjennsy  路  4Comments

Neill83 picture Neill83  路  3Comments

makarov906 picture makarov906  路  4Comments