Skip to content
This repository was archived by the owner on May 29, 2019. It is now read-only.

Tooltip append-to-body? #2445

Closed
sgarbesi opened this issue Jul 11, 2014 · 5 comments
Closed

Tooltip append-to-body? #2445

sgarbesi opened this issue Jul 11, 2014 · 5 comments

Comments

@sgarbesi
Copy link

Instead of append-to-body why not have it be append-to-parent that way we can choose a specific parent we want to append the tooltips to?

I'm having an issue where I need the tooltip to live within a specific container so I can give it a unique style that differs from the rest of the website. The problem is the tooltip mucks with the positioning of other elements being in the current container.

...or having a tooltip-class would be even better! I see the benefits in having both. I don't see the benefits of restricting the options to simply the body and current container. Would this not be an easy implementation?

@pkozlowski-opensource
Copy link
Member

@sgarbesi how would you like to specify a parent? I can think of 2 options:

  • a DOM element - but this somehow implies DOM manipulation (I need to get a hand on a DOM element somehow)
  • a CSS selector - but we don't require people to use jQuery so we would have to stick to what Angular's https://docs.angularjs.org/api/ng/function/angular.element find provides which is basically lookup by a tag name :-/

Can you think of something else that would be generic and easy to implement?

@sgarbesi
Copy link
Author

@pkozlowski-opensource passing a reference to the instance of the element should suffice?

data-parent="document.getElementById('x')"

You could probably even have a special case:

data-parent="body"

Redirect to document.getElementsByTagName('body')[0] ?


Sorry for not being clear enough. I wasn't looking for a CSS selector, but rather a CSS class to apply to the tooltips in question.

data-className="test123"

When the tooltip is spawned it now has a class of test123.

@pkozlowski-opensource
Copy link
Member

passing a reference to the instance of the element should suffice

Yes, this could be an option - but this kind of promotes non-AngularJS API so I'm not sure I want to go down this path. There is some discussion in the AngularJS itself about allowing all selectors for angular.element, so it might get easier with time.

Alternatively, we could use http://caniuse.com/queryselector as it seems to be supported in all browsers we care about supporting. Yeh, this should be doable.

@sgarbesi
Copy link
Author

sgarbesi commented Aug 7, 2014

@pkozlowski-opensource Sounds okay to me. You plan on coding this or should I give it a shot and make a pull request?

@icfantv
Copy link
Contributor

icfantv commented Aug 6, 2015

Closing this due to inactivity. Please feel free to reopen if this is still an issue and you would like to submit a PR.

@icfantv icfantv closed this as completed Aug 6, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants