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

Rewrite Tooltip and Popover #14327

Closed
tlindig opened this issue Aug 5, 2014 · 5 comments
Closed

Rewrite Tooltip and Popover #14327

tlindig opened this issue Aug 5, 2014 · 5 comments

Comments

@tlindig
Copy link
Contributor

tlindig commented Aug 5, 2014

May be it is time to rewrite the tooltip and popover and outsource the complexity of position calculation to a specialized pluglin like PosititionCalculator . OK, that is from myself but it does what you need.

Then the bootstrap tooltip and popover only need to apply the calculated position, add the correct class for orientation (to get the arrow to the right side) and manage events.

Here is an simple example: http://jsbin.com/sifec/9/edit?html,js,output

You would get for free the auto position with flip and stick depending on a viewport / boundary with 9 possible placements instead of the 4 you now supports.

That could solve issues like this:
#14322, #14323, #14197, #13934, #13897 ...

@cvrebert
Copy link
Collaborator

cvrebert commented Aug 5, 2014

Another library option might be Tether (http://github.hubspot.com/tether/).
Anyway, I personally agree with the thrust of the suggestion, that we should outsource this particularly tricky part of the code to another library if feasible.

@tlindig
Copy link
Contributor Author

tlindig commented Aug 5, 2014

As @cvrebert said:

(Another library option is http://github.hubspot.com/tether/ )

Yes that library handle auto placement for you too. But it does some more stuff:

  • it has focus to scrolling issues. So it change the DOM to attach the the popup element to body, if it is out of viewport of a scrolling container.
  • it brings a lot code that do the same, that jQuery can do, to be independent of jQuery
  • it set own styles to the popup element to set it position
  • it adds some css classes to view elements

For my project, it was to much.

@hnrch02
Copy link
Collaborator

hnrch02 commented Aug 5, 2014

I agree that this particular part of the code is rather tricky but I'm not sure how I feel about adding another third-party dependency. Anyways, it's @fat's call.

@fat
Copy link
Member

fat commented Aug 15, 2014

yeah… i didn't write any of the positioning stuff for the tooltip because i was kind of meh about adding it in the first place.

it should probably be revisited in v4 – not sure whether we should rewrite it ourselves or use a third party lib. +/- with both

@mdo
Copy link
Member

mdo commented Aug 23, 2014

Noted for v4.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants