foundation-sites: Dynamically created tooltip are not working.

To reproduce: Go to the tooltip documentation page and do this in the console:

$('body').prepend('<span data-tooltip class="has-tip" title="Tooltips are awesome, you should totally use them!">extended information</span>')

The link created on the top of the windows should be a valid tooltip but its not, instead I have to manually trigger the $(document).foundation() call again to make it work…

Reading #3955, delegation of event should take care of this.

I don’t have time to dig this right now so if you have any clue to speed my research, please let me know 😉

About this issue

  • Original URL
  • State: closed
  • Created 10 years ago
  • Reactions: 2
  • Comments: 39 (18 by maintainers)

Most upvoted comments

@SassNinja it doesn’t mean that you have to ignore the issue at all either. If someone asks about a behaviour the maintainer should at least respond

We can and do not always respond to all issues as we are volunteers and also work on other projects. Sorry but I think you are not aware of how it is to be a maintainer, answer issues, create PRs, test things, …

It costs much energy. GitHub is a collaboration platform and opensource is a product of many volunteers providing their free time to help to create better products together.

We did not ignore this issue. It was stale for a long time and we have no PR so far (we would have to think about and test a solution).

@SassNinja provided some possible ways for a solution.

@tedivm one year has passed since your first comment to this issue and how much have you contributed to this framework? Nothing, not even forked! Open source doesn’t mean you get everything you ask for without doing anything. So instead of complaining you could have used the time to create a PR solving the issue or help with the one in talk.

@steoo same to you: your fist comment to this issue was more than 3 years ago and you haven’t contributed anything yet and not even forked this repo either!

I’m slowly migrating everything to custom things or other libraries

Means in the end you need to write code yourself anyway (just not for Foundation) or are dependent on another project again what will only work as long as there are enough developers taking care of all unpaid requests.

back 2 topic:

I’ve just gone through the whole issue and think there are two problems:

  1. changing the title of an existing tooltip doesn’t work (sth as reflow or reinit is missing) – possible fix in https://github.com/zurb/foundation-sites/pull/10957/files
  2. adding a new tooltip to DOM always requires to initialize it (either via foundation() or via new Foundation.Tooltip()) and can’t work as expected by @johnraz

The latter can not be fixed because it’s caused by the architecture of Foundation. Each tooltip is an individual plugin instance and therefore has to get initialized. Just adding a new tooltip elem without taking care of it doesn’t work by design.

Maybe something we might consider for Foundation v7 @ncoden ?

Same issue here with dropdowns, I have to call $(document).foundation() again to make them work.