Skip to content

docs: explain why tooltips, popovers, toasts, and carousels are opt-in#42360

Open
pierluigilenoci wants to merge 1 commit intotwbs:mainfrom
pierluigilenoci:docs/tooltip-popover-opt-in-explanation
Open

docs: explain why tooltips, popovers, toasts, and carousels are opt-in#42360
pierluigilenoci wants to merge 1 commit intotwbs:mainfrom
pierluigilenoci:docs/tooltip-popover-opt-in-explanation

Conversation

@pierluigilenoci
Copy link
Copy Markdown
Contributor

Summary

Expands the "opt-in for performance reasons" notes in the Tooltip, Popover, Toast, and Carousel documentation pages to actually explain what those performance reasons are:

  • Tooltips & Popovers: each instance creates a Popper instance that tracks scroll and resize events; auto-initializing all of them on every page load would add unnecessary overhead when most pages use none or only a few.
  • Toasts: auto-initialization would register timers and event listeners even when no toasts are visible, wasting resources on pages that create toasts dynamically.
  • Carousels: auto-initialization would register touch, swipe, scroll, and resize event listeners for carousels that may not yet be visible or interactive.

This has been a long-standing documentation gap — the original "opt-in for performance reasons" phrasing dates back at least 6 years but never explained the reasoning. Users frequently miss the initialization requirement (see #24985, #15458), and a clear explanation helps them understand why the extra step exists.

Fixes #29378

Note

This PR addresses the v5 documentation. Per @mdo's comment, v6 already auto-initializes tooltips and popovers, but carousels and toasts still mention manual initialization.

AI-assisted development

This PR was developed with the assistance of AI tools (Claude Code). All changes were reviewed, validated, and approved by the author.

@pierluigilenoci pierluigilenoci force-pushed the docs/tooltip-popover-opt-in-explanation branch from 5318eec to 20c3fce Compare May 3, 2026 17:30
Expand the "opt-in for performance reasons" notes in the Tooltip,
Popover, Toast, and Carousel docs to explain what those performance
reasons actually are: each instance creates Popper positioning or event
listeners that would add unnecessary overhead if auto-initialized on
every page load.

Fixes twbs#29378

Signed-off-by: Pierluigi Lenoci <pierluigilenoci@gmail.com>
@pierluigilenoci pierluigilenoci force-pushed the docs/tooltip-popover-opt-in-explanation branch from 20c3fce to cc9da05 Compare May 7, 2026 16:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Expounding on "opt-in for performance reasons"

2 participants