Skip to content

Docs: fix the JavaScript of the StackBlitz examples - #43110

Merged
julien-deramond merged 3 commits into
mainfrom
main-jd-stackblitz-js
Oct 17, 2026
Merged

julien-deramond merged 3 commits into
mainfrom
main-jd-stackblitz-js

Conversation

@julien-deramond

@julien-deramond julien-deramond commented Oct 17, 2026 •

Copy link
Copy Markdown
Member

The "Try it on StackBlitz" button of every docs example that needs JavaScript opens a playground where nothing runs. The indeterminate checkbox stays unset, and the tooltip, popover, live alert and toast examples do nothing. Three things got in the way. The button that @twbs/bui renders no longer has the data-sb-js-snippet attribute that stackblitz.js reads, so the playground never got the snippets. Those snippets start with import { … } from '@bootstrap', an alias that only exists in the docs build. And the playground loaded the v6 bundle with a classic <script defer>, but that bundle is an ES module that defines no window.bootstrap, so it threw a syntax error.

stackblitz.js now sends the snippets with every playground, since @twbs/bui only shows the button on examples marked addStackblitzJs. The playground keeps the javascript template, as on v5, and lists bootstrap at the docs' current version as a dependency. The snippets import from bootstrap/dist/js/bootstrap.bundle.js, which also sets up the data API, so index.html no longer loads a script of its own. The version comes from current_version in config.yml, through the same Vite plugin that fills in the CDN links.

I tried the other ways first, in StackBlitz itself. Its html template runs every script as a classic script, so neither an index.js module nor an inline <script type="module"> runs there. In the javascript template, its loader fetches a CDN URL and runs it as a classic script too, so importing the CDN bundle fails on export. Importing the npm package's bundle works because StackBlitz converts it for its loader, and the bundle also saves listing @floating-ui/dom and vanilla-calendar-pro, which the package's main entry needs as peer dependencies.

I checked it in a real StackBlitz session with the files this code builds: the indeterminate checkbox shows its dash, the "Tooltip on bottom" example shows its tooltip on hover, and a data-bs-toggle="collapse" button opens its target.

Fixes #43109

Tests

Tooltips: tooltip page

Overview: the tooltip shows on hover.
Tooltips on links: hover the links in the text.
Custom tooltips: the custom style comes from the example’s class on .
Interactive tooltips
Disabled elements

Popovers: popover page

Overview, Live demo, Placement, Responsive placement, Custom popovers, Dismiss on next click, Disabled elements: the popover opens on click.

Others

Alert, Live example: the button adds an alert.
Toasts, Placement: the select moves the toast.
Checkbox, Indeterminate: the checkbox shows its dash.

🤖 Generated with Claude Code

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@julien-deramond julien-deramond added docs Documentation site and its content js JavaScript or TypeScript sources and plugins v6 v6, the main branch bug Something does not work as documented labels Oct 17, 2026
julien-deramond and others added 2 commits October 17, 2026 10:45
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@julien-deramond
julien-deramond marked this pull request as ready for review October 17, 2026 09:05
@julien-deramond
julien-deramond requested a review from a team as a code owner October 17, 2026 09:05
@github-project-automation github-project-automation Bot moved this to Inbox in v6.0.0 Oct 17, 2026
@julien-deramond
julien-deramond merged commit 38e57e5 into main Oct 17, 2026
13 checks passed
@julien-deramond
julien-deramond deleted the main-jd-stackblitz-js branch October 17, 2026 09:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something does not work as documented docs Documentation site and its content js JavaScript or TypeScript sources and plugins v6 v6, the main branch

Projects

Status: Inbox

Development

Successfully merging this pull request may close these issues.

v6 docs: indeterminate checkbox stackblitz

1 participant