Migrate to Bootstrap 5.3#93
Conversation
`mediawiki/bootstrap` ^6.0 ships Bootstrap framework 5.3.x; the prior ^5.0 ships BS4. Adds a `dev-master` branch alias to 6.x-dev so the v6 development line is explicit. Wires the new `ext.bootstrapComponents.modal.js` init script onto the `modal.fix` module. The init script (added in a follow-up commit) calls `bootstrap.Modal.getOrCreateInstance` on every `.modal`, replacing the implicit jQuery `[data-toggle="modal"]` lifecycle that BS4 ran automatically and BS5 no longer does. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
808af8f to
552e618
Compare
|
2f66741 to
157397b
Compare
Jumbotron contained-heading sizingHistorical chain:
Options if we decide to act later
|
78f1284 to
72241a6
Compare
Accordion uses BS3-vestigial markup, not BS5 native primitivesHistorical chain:
Current behaviour under BS5Functionally working: clicking a header expands the pane, expanding one pane collapses siblings via Visually: a stack of independently-bordered Why this PR doesn't restructureThe work would be a rewrite of Options if we decide to act later
|
9b771b9 to
3518826
Compare
BootstrapComponents' JS modules wired Popover and Tooltip via jQuery's top-level `$( '...' ).popover()` / `.tooltip()` calls. Bootstrap 5 dropped its jQuery dependency entirely, so the per-component init that BC owns has to switch to vanilla DOM + `bootstrap.X.getOrCreateInstance` calls. Switch all four init modules accordingly: * targets the BS5 `data-bs-toggle` attribute set by the PHP emitters, * calls the relevant `bootstrap.Modal|Popover|Tooltip|Carousel` constructor on every matching element after DOMContentLoaded. Popover and Tooltip are opt-in in BS5 (no framework-side delegation) so their init scripts are required. Modal and Carousel aren't strictly required — BS5 still auto-binds modal trigger clicks and carousel `data-bs-ride` via its data-api — but the explicit loops mirror Popover/Tooltip's shape and ensure programmatic `bootstrap.Modal.getOrCreateInstance(el).show()` works without first racing the data-api init. `ext.bootstrapComponents.modal.js` is new and wired onto `modal.fix` in the previous commit. The other three replace the jQuery `$(...).popover()` / `$(...).tooltip()` / `$(...).carousel()` top-level calls. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Bootstrap 5 namespaced all its data-attribute hooks with a `bs-` prefix (`data-bs-toggle`, `data-bs-target`, etc.) to stop conflicting with authoring code. Update every BC component that emits these attributes plus `ModalBuilder` and its trigger-matching regexes: * `Components/Modal.php` — `data-toggle`/`data-target` on the trigger button. * `Components/Popover.php` — `data-toggle`, `data-content`, `data-placement`, `data-trigger`. * `Components/Tooltip.php` — `data-toggle`, `data-placement`. * `Components/Carousel.php` — `data-ride`, `data-slide`, `data-slide-to`, `data-target` on indicators. * `Components/Card.php` — `data-toggle`/`data-target` on collapsible card heads, `data-parent` on accordion children. * `Components/Collapse.php` — `data-toggle` on the toggle button. * `Components/Alert.php` — `data-dismiss` on the close button. * `ModalBuilder.php` — `data-toggle`/`data-target`/`data-dismiss` in the emitted markup, plus the `preg_match` regexes that test for a user-supplied trigger pointing at the modal. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Bootstrap 5 dropped several BS3/BS4 class names that BC's PHP emitters were hard-coding. Update the affected sites to BS5 equivalents: * `Components/Badge.php` — `badge-pill` -> `rounded-pill`, and the `badge-<color>` family -> the BS5 `text-bg-<color>` utilities that set background AND a contrasting foreground. * `Components/Alert.php` — close button switches from BS4's `class="close"` + `<span aria-hidden>×</span>` shape to BS5's self-styled `class="btn-close"` (no inner span; the X is drawn by the class via a background SVG). * `Components/Jumbotron.php` — `.jumbotron` was removed in BS5; recreate the same look with utility classes per the BS5 example. * `ModalBuilder.php` — same close-button shape change as Alert, and switch the footer dismiss button from BS4's removed `btn-default` to `btn-secondary` (BS5 default colour). * `Components/Modal.php` — whitespace-only realign of the array literal to keep keys consistent with the renamed `data-bs-*` entries. `color="default"` on Modal / Popover / Button / Badge is deliberately left as-is. BS5 (and BS4) have no rule for `*-default`, so it renders effectively-unstyled; back-compat for existing wikitext is preserved by accepting the value, not by translating it. See the migration guide for the decision and the recommended user-side replacements. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Bootstrap 5's carousel indicator example uses `<div class="carousel-indicators">` holding `<button>` elements rather than the BS3-era `<ol>/<li>` shape. The button form is what Bootstrap's JS wires keyboard focus and `aria-current` on. The old markup still renders visually under BS5 CSS but doesn't pick up the accessibility behaviour. Switch the wrapper to `<div>`, the indicator elements to `<button>`, and add `aria-current="true"` on the initially-active indicator + `aria-label` on each. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
The PHP emitters now produce `data-bs-*` attributes, BS5 class names (`rounded-pill`, `text-bg-<color>`, `btn-close`, the utility-class jumbotron set, `btn-secondary` modal footer dismiss), and BS5 `<button>` carousel indicators. Update the expected strings in: * `Components/*Test.php` — data-attribute renames, badge class renames, close-button shape, jumbotron utility classes, carousel `<ol>/<li>` -> `<div>/<button>` markup, modal footer dismiss button colour, `default` -> `secondary` colour mapping. * `ImageModalTest.php`, `ImageModalTriggerTest.php`, `ModalBuilderTest.php` — same renames inside the modal markup these tests exercise via `ModalBuilder`. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
* `docs/release-notes.md` — write a focused 6.0.0 entry covering the
actual BS5-lift changes (Bootstrap-extension bump, attribute renames,
JS modules, class-name updates, carousel indicator markup,
`color="default"` back-compat note). The MediaWiki (1.43) and PHP
(8.1) floors are unchanged from 5.x and not listed under "Breaking
changes". The bug-fix entries that already shipped in 5.2.3 / 5.2.4
are not re-listed under 6.0 since 6.0 inherits them from the 5.x
line.
* `docs/migration-guide.md` — new file. Step-by-step upgrade guide
for wiki admins moving from BC 5.x (Bootstrap 4) to BC 6.0 (BS5).
Explicitly notes that the MW and PHP floors are unchanged; the only
new requirement is `mediawiki/bootstrap` ^6.0.
* `docs/components.md` — note the jumbotron now emits utility classes
instead of the removed `.jumbotron` class.
* `docs/components/*.md` — update Bootstrap-version text references
(`4.1` -> `5.3` doc URLs, "default" colour notes).
* `docs/known-issues.md` — replace the pre-5.2.4 modal-backdrop
workaround sections (which told users to add `.modal-backdrop {
display: none }` to their wiki CSS) with a single entry describing
the current shipped behaviour: the workaround CSS now rides along
with the extension and is applied automatically on Vector and
Vector 2022 (the only two skins where the page-container traps
the modal under its backdrop on MW 1.43+). Point at #91 for the
root-cause tracking. Refresh the navbar-overlaps-modal section
opener so it no longer leans on the removed backdrop-troubleshooting
context.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Scope discipline
This PR is the BS4→BS5 framework lift only.
Not in scope:
popover.vector-fixBS3 selector,.alert-defaultcleanup (the*-defaultfamily remains effectively-unstyled in this PR; see thecolor="default"open question),.carousel-inner > .itemcleanup — tracked at Revisit per-skin module loading mechanism #90.Verification
Tested with MW 1.43.8,
mediawiki/bootstrap ^6.0(Bootstrap framework 5.3.x), Chameleon at master HEAD (128fe31) and Medik at master HEAD (f7ca0ac). Two candidate wikis stood up side-by-side: Chameleon-default and Medik-default. Skin:Chameleon and Skin:Medik are only installed on their respective stack (useskin=<other-BS-skin>falls back to the wiki's default), so each was exercised on the stack that actually loads it. MW-core skins (vector-2022,vector,monobook,timeless) were exercised via?useskin=.A single wikitext test page,
BCTestMatrix, exercises every BC component across every documented attribute / colour / size / placement value (modals in five colours and three sizes, popovers in four placements and three trigger modes, eight alert colours plus dismissible variants, three-pane accordion, three-image carousel, the full button / badge / card / jumbotron matrix). Each interactive component was driven via Playwright with real user-input events (realmouseenterfor tooltips, click toggles for collapse / modal / popover), and assertions cover both the visible state (.modal.show,.popover.showwith BS5-shaped.popover-header/.popover-body,.btn-close-style dismissals) and the framework-level z-indices (modal 1055 / backdrop 1050 / popover 1070).Per-skin matrix of JS-driven components
Badge, Button, and Jumbotron have no JS and aren't listed; their rendering is covered by the screenshots below.
The ⚠ on the Medik / Card cell is the collapsible variant only; static cards render correctly. See Known issues below.
Rendered output per skin
The same
BCTestMatrixwikitext rendered under each skin (full-page screenshots):Test page wikitext: BCTestMatrix.txt
Side-by-side baseline comparison against the BS4 5.x release showed only expected BS4→BS5 stylistic evolution: BS5's
.btn-closeSVG icon vs BS4's×character; softer pastel BS5 alert palette; jumbotron utility-class composition (p-5 mb-4 bg-body-tertiary rounded-3) replacing the dropped.jumbotron. No functional or layout regressions outside the Skin:Medik card-collapsible defect noted below.Known issues
Skin:Medik card-collapsible doesn't re-collapse. The body opens on the first click but stays open on subsequent clicks. Root cause: BS5's JS ends up loaded twice on the page — once via
skins.medik.js(Medik is a BS-based skin and bundles the framework directly), and once via BC'sext.bootstrap.scripts. Both copies bind a click delegation to[data-bs-toggle="collapse"], so each click fires the toggle handler twice. Modal / popover / tooltip / accordion / carousel / alert-dismiss all survive the double-init because BS5's_isTransitioningshort-circuit absorbs the duplicate event; Collapse on a.fade-classed body re-shows itself. The fix is BC-side: #70 ("Remove hard dependency on Extension:Bootstrap") already tracks making BC detect when BS is already loaded by the environment and skip its own load.