Skip to content

fix(lightbox): link lightbox/skeletons/mission-side-nav CSS in head (never injected by js.Build) - #1814

Merged
jung-thomas merged 1 commit into
DEVfrom
fix/lightbox-css-not-linked
Aug 15, 2026
Merged

jung-thomas merged 1 commit into
DEVfrom
fix/lightbox-css-not-linked

Conversation

@jung-thomas

Copy link
Copy Markdown
Contributor

Problem

The image lightbox (#1785) opens but is unstyled on DEV and PROD: the dialog dumps every image at full size, stacked, with no single focused image and no chrome — reported as "shows all items in one dialog."

Root cause

hugo/assets/js/ui5-bootstrap.ts does import "../css/lightbox.css" (also skeletons.css, mission-side-nav.css) expecting the CSS to be injected. But that file is built by Hugo's js.Build (esbuild) — which has no CSS-injection step (unlike the hugo-apps Vite build's vite-plugin-css-injected-by-js). esbuild inlines the CSS as a dead string that never becomes a <style>, so it never applies. view-transitions.css/scroll-animations.css work only because head.html also <link>s them — these three were never added to that list.

This has been broken since the lightbox first shipped. The old lightbox (single image) tolerated it; #1785's thumbnail filmstrip renders full-size unstyled → made the gap visible.

Fix

  • Add fingerprinted <link>s for lightbox.css, skeletons.css, mission-side-nav.css in head.html (same pattern as the 10 existing links).
  • Remove the now-dead import "../css/*.css" from ui5-bootstrap.ts (they only bloated the 3.5 MB bundle) and add a note so they aren't re-added.

Also fixes two silently-broken features hit by the same bug: skeleton loaders and the mission side-nav.

Verification (real browser, local build)

Playwright before → after on /tutorials/abap-environment-trial-onboarding/:

  • .lightbox-viewport: overflow:visible; position:static → overflow:hidden; position:relative
  • thumbnails: 1456×648px (full size) → 64×48px (4rem×3rem)
  • built head now links css/lightbox.min.<hash>.css (200, contains .lightbox-thumb{…width:4rem)
  • bundle no longer carries --lightbox-bg; 18/18 lightbox unit tests pass

Follow-up (not in this PR)

Consider a smoke assertion that a tutorial page links a fingerprinted lightbox.css that serves 200 — this regression was invisible to CI for months.

These three stylesheets were only imported by hugo/assets/js/ui5-bootstrap.ts,
which Hugo builds via js.Build (esbuild) — no CSS-injection step (unlike the
hugo-apps Vite build's vite-plugin-css-injected-by-js). esbuild inlined the CSS
as a dead string that never produced a <style>, so the CSS never applied.

Symptom: the image lightbox (#1785) opened but was unstyled — thumbnails
rendered at full image size and stacked, i.e. 'all images shown in one dialog'.
Skeleton loaders and the mission side-nav were unstyled by the same bug. Present
on DEV and PROD since the lightbox first shipped; #1785's thumbnail filmstrip
made the pre-existing CSS-delivery gap visible.

Fix: add fingerprinted <link>s in head.html (same pattern as view-transitions/
scroll-animations, which work precisely because they are also linked here) and
drop the dead imports from ui5-bootstrap.ts.

Verified in a browser on a local build: .lightbox-viewport now overflow:hidden/
position:relative and thumbnails render at 4rem/3rem (was full-size); bundle no
longer carries lightbox.css. 18/18 lightbox unit tests pass.
@jung-thomas
jung-thomas merged commit 487c8d4 into DEV Aug 15, 2026
3 of 4 checks passed
@jung-thomas
jung-thomas deleted the fix/lightbox-css-not-linked branch August 15, 2026 15:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant