Enable tooltip for nested element

When an element nested in other elements, the current implementation cause the tooltip to flicker between the title of the two. This pull request fixes this.