Tippyjs: hideOnClick = persistent not working

Created on 11 Jul 2017  路  3Comments  路  Source: atomiks/tippyjs

Hello,

I want to use tippy with Typescript for a Tutorial with Angular 4. This is how I create my tooltip:

 const element = document.querySelector("dm-assignee-selection");
      const p = document.createElement("div");
      p.innerText = "Hello world";
      document.body.appendChild(p);
      const tippy = (window as any).tippy;
      const tip = tippy(element, {html: p, // OR document.querySelector('#my-template-id')
        arrow: true,
        animation: "fade",
      hideOnClick: "persistent"});
      console.log(tip);
      const popper =  tip.getPopperElement(element);
      tip.show(popper);

The tooltip is shown. However, when I click outside of the tooltip, it disappears. However, as far as I understand persistent should prevent that. Am I doing something wrong here?

Thanks a lot,
Christian

Most helpful comment

I'm not sure what you mean. Usually 'persistent' is used for the click trigger. How can you click outside if you're hovering? Or are you referring to focus?

I see you're manually showing it. In that case, give it trigger: 'click' or trigger: 'manual' and it should work.

All 3 comments

I'm not sure what you mean. Usually 'persistent' is used for the click trigger. How can you click outside if you're hovering? Or are you referring to focus?

I see you're manually showing it. In that case, give it trigger: 'click' or trigger: 'manual' and it should work.

That is the fastest response I ever got. You're correct, trigger: "manual" fixes it. Thank you very much. :)

It would be great if the docs could be updated to note that hideOnClick: "persistent" only works if you set trigger: "manual". Took me a while to eventually figure out the combination. Thanks for Tippy!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

faroukcharkas picture faroukcharkas  路  4Comments

andrewckor picture andrewckor  路  4Comments

khanamiryan picture khanamiryan  路  5Comments

Neill83 picture Neill83  路  3Comments

mreinstein picture mreinstein  路  5Comments