Repository navigation
fix(lightbox): link lightbox/skeletons/mission-side-nav CSS in head (never injected by js.Build) - #1814
Merged
Conversation
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.
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.
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.tsdoesimport "../css/lightbox.css"(alsoskeletons.css,mission-side-nav.css) expecting the CSS to be injected. But that file is built by Hugo'sjs.Build(esbuild) — which has no CSS-injection step (unlike the hugo-apps Vite build'svite-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.csswork 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
<link>s forlightbox.css,skeletons.css,mission-side-nav.cssinhead.html(same pattern as the 10 existing links).import "../css/*.css"fromui5-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:relativecss/lightbox.min.<hash>.css(200, contains.lightbox-thumb{…width:4rem)--lightbox-bg; 18/18 lightbox unit tests passFollow-up (not in this PR)
Consider a smoke assertion that a tutorial page links a fingerprinted
lightbox.cssthat serves 200 — this regression was invisible to CI for months.