seiyria / bootstrap-slider

A slider control for Bootstrap 3 & 4.
http://seiyria.github.io/bootstrap-slider/
Other
3k stars 1.14k forks source link

Tooltips via Popper.js? #952

Open edemaine opened 3 years ago

edemaine commented 3 years ago

Bootstrap.js (since v4) uses Popper.js to display tooltips. One of the nice things about Popper.js is that has flags to automatically prevent tooltips from leaving the screen and to flip orientation of tooltips to do the same. I've grown to really like these, and now my bootstrap-slider tooltips stick out (literally) for not having this feature -- especially my left and right extreme tooltips tend to extend beyond the screen width (previously reported in #649).

It would be nice to be able to use Popper.js for slider tooltips. I see a few possibilities:

  1. Add Popper.js as a dependency; hopefully not an issue for people using Bootstrap, though there are Popper v1 vs. v2 issues. (I believe Bootstrap v4 uses Popper v1 while Bootstrap v5 uses Popper v2, and there are some compatibility issues.)
  2. Detect Popper.js and use it if so (similar to current jQuery dependency).
  3. Add callback/option(s) for custom tooltips that would allow someone to switch to Popper.js (or another system) themselves.

Do you have a sense of which of these options (if any) would be most preferable from your perspective?

seiyria commented 3 years ago

Personally, if I were to review/accept a PR for this, it would have to be option 2, or 3, or both (ideally, both, with the third overriding the second). We do not have any dependencies and I would like to keep it that way, although we do have popper as a devDep (not sure why; I would have to review to see).

We would happily accept a PR for this!