bootstrap icon indicating copy to clipboard operation
bootstrap copied to clipboard

Expounding on "opt-in for performance reasons"

Open jonathanhefner opened this issue 6 years ago • 6 comments

In the documentation for both Tooltips and Popovers is the caveat: "opt-in for performance reasons, so you must initialize them yourself." But I'm having trouble finding a detailed explanation of "performance reasons." The caveat is at least 6 years old, which makes me wonder if it's still true.

Also, many people miss this caveat when reading the documentation, for example #24985 and #15458. So it would be great if Tooltips and Popovers could actually be automatically initialized in a performant way. That might also pair nicely with using MutationObserver to automatically remove Tooltips in v5.

jonathanhefner avatar Sep 06 '19 17:09 jonathanhefner

Hi @jonathanhefner, there is a way to do that, you can use our selector option and it'll initialize Popovers and Tooltip automatically. Maybe after the switch to our v5 (without jQuery) we can remove that 🤔

Johann-S avatar Sep 06 '19 18:09 Johann-S

Bumping @twbs/js-review on this—would we want to make this the default in v5? Is that a breaking change that we'd need to punt to v6?

mdo avatar Jan 12 '21 05:01 mdo

TBH we need some kind of benchmark before everything else. The reasons behind this choice may no longer apply to v5, but it can indeed be a breaking change.

XhmikosR avatar Jan 12 '21 06:01 XhmikosR

Follow up / tangential to this as a user of bootstrap:

  1. The "opt-in" requirement and guidance already seemed weird because adding the `data-[bs-]toggle='tooltip`` attribute to an element already is EXPLICIT that you want tool-tip popup behavior.
  2. Inconsistency with other controls - why the additional extra step of manual JavaScript initialization when default behavior it to self-initialize from data attributes.

lacutah avatar Mar 25 '21 22:03 lacutah

I agree with @XhmikosR on needing to re-evaluate this. @twbs/js-review Can any of you review and make a suggestion for how to better handle tooltips and popovers here without requiring extra work?

mdo avatar Jun 14 '21 19:06 mdo

I think we drop this entirely and make them automatically work. Adding to v6 plans.

mdo avatar Feb 26 '25 18:02 mdo