Repository navigation
Docs: fix the JavaScript of the StackBlitz examples - #43110
Merged
Merged
Conversation
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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/buirenders no longer has thedata-sb-js-snippetattribute thatstackblitz.jsreads, so the playground never got the snippets. Those snippets start withimport { … } 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 nowindow.bootstrap, so it threw a syntax error.stackblitz.jsnow sends the snippets with every playground, since@twbs/buionly shows the button on examples markedaddStackblitzJs. The playground keeps thejavascripttemplate, as on v5, and listsbootstrapat the docs' current version as a dependency. The snippets import frombootstrap/dist/js/bootstrap.bundle.js, which also sets up the data API, soindex.htmlno longer loads a script of its own. The version comes fromcurrent_versioninconfig.yml, through the same Vite plugin that fills in the CDN links.I tried the other ways first, in StackBlitz itself. Its
htmltemplate runs every script as a classic script, so neither anindex.jsmodule nor an inline<script type="module">runs there. In thejavascripttemplate, its loader fetches a CDN URL and runs it as a classic script too, so importing the CDN bundle fails onexport. Importing the npm package's bundle works because StackBlitz converts it for its loader, and the bundle also saves listing@floating-ui/domandvanilla-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