Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tooltip only show on first element #1188

Closed
Rc85 opened this issue Aug 28, 2018 · 1 comment
Closed

Tooltip only show on first element #1188

Rc85 opened this issue Aug 28, 2018 · 1 comment

Comments

@Rc85
Copy link

Rc85 commented Aug 28, 2018

reactstrap version 6.4
react verison 16.4.2
bootstrap 4

In cases where there are elements with the same ID created through a loop or rendered from reusable components, the tooltip only show for the first element with the ID.

I try to fix it myself but I lack the knowledge of reading other people's code. The issue, I suspect lies here

function getTarget(target) {
  var els = findDOMElements(target);
  if (isArrayOrNodeList(els)) {
    return els[0];
  }
  return els;
}

It's always returning the first element of the list, even when there are more than one elements. In the original bootstrap 4, it initializes tooltip for any elements with the attribute data-toggle (from the example), thus allowing same tooltip to show on different same elements. Consider using a loop to loop through NodeList and apply the addEventListener.

@TheSharpieOne
Copy link
Member

Duplicate of #1185

@TheSharpieOne TheSharpieOne marked this as a duplicate of #1185 Aug 31, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants