Thanood / aurelia-mdl-skeleton-navigation

A fork of aurelia-skeleton-navigation, using Material Design Lite.
MIT License
4 stars 2 forks source link

mdl-tooltip only works for the first instance in any one div #16

Closed egeland closed 8 years ago

egeland commented 8 years ago

If you put more than one tooltip on something inside the same div, only the first one works.

<div>
  <i mdl-tooltip="text: Testing" class="material-icons">mood</i>
  <i mdl-tooltip="text: Testing2" class="material-icons">person</i>
</div>

The tooltip will appear on the 'mood' icon, but nothing for the 'person'.

Thanood commented 8 years ago

Interesting.. The tooltip has some other bugs as well. I will have a look at it..

Thanood commented 8 years ago

It's because of this implementation:

componentHandler.upgradeElement(target.parentNode.querySelector('.mdl-tooltip'));

It selects only the first. Changed it to:

componentHandler.upgradeElement(target.parentNode.querySelector(`.mdl-tooltip[for="${this.element.id}"]`));