Deck thumbnail rail always shows slide 1 for reveal.js-based decks (getComputedStyle can't see ancestor-driven hiding)
What happened?
When a generated deck uses a real, self-navigating presentation library (reveal.js is the concrete case we hit) instead of OpenDesign's own .slide.active convention, the deck thumbnail rail shows the same slide (always the first one) for every single slide, even though the main preview pane navigates correctly and each slide's own markup is genuinely different. Observed directly in the product with a real 9-slide deck (screenshot on file, but it contains confidential business content so it isn't attached here - the minimal repro below reproduces the same underlying DOM signature with placeholder content instead).
Steps to reproduce
- Save the attached
index.html(bottom of this issue) as an OpenDesign project's deck file, or just open it directly in a browser first to inspect the underlying DOM state described in "Evidence" below (no OpenDesign build needed for that part). - Open it as a deck in OpenDesign.
- Look at the thumbnail rail on the left. All 3 thumbnails render "Slide 1 - Welcome", even though the main preview correctly shows slide 2 / slide 3 when you navigate there.
Expected behavior
Each thumbnail in the rail should render its own slide's content, matching what the static shadow-DOM thumbnail path already does correctly for OpenDesign's own deck conventions.
Root cause
Two independent things have to be true for this bug to surface, both verified separately below.
Stage 1 - the deck gets routed to the per-slide <iframe> fallback (this part is correct, existing behavior)
parseDeckThumbnails() (apps/web/src/runtime/deck-thumbnail-parser.ts) normally extracts each slide's markup statically so the rail can render a cheap shadow-DOM clone with no live JS (DeckSlideThumbnail.tsx). It refuses to do that (renderable: false) for two independent reasons, checked in this order:
- Any
<link rel="stylesheet">in the document →reason: 'external-stylesheet'(the link-loop check, ahead of the CSS parsing). - Otherwise, any
@mediarule in the inline<style>CSS that referenceswidth/height/min-width/max-width/etc →reason: 'viewport-media-query', viahasViewportMediaQuery().
The original report's deck had its CSS fully inlined via <style> (no <link> tags at all) and its bundled reveal.js theme CSS contained ordinary responsive rules like @media screen and (min-width: 500px). I confirmed that trips hasViewportMediaQuery() by running the function's own regex logic (ported verbatim) against that CSS: it returns true.
The attached minimal repro below instead uses <link> tags (to keep the repro small instead of inlining reveal.js's ~50KB stylesheet), so it trips the other check, external-stylesheet, first. Both checks are independent and either one alone is sufficient to force renderable: false - the specific reason doesn't matter, only that parsedDeckThumbnails ends up null and DeckThumbnailRail falls back to the per-slide <iframe> path (DeckIframeThumbnail). I want to be upfront that the repro hits the fallback via a different reason than the original report did, since they're easy to conflate; both are demonstrated to work.
Stage 2 - the iframe fallback's move-verification heuristics can't see this deck move at all (this is the actual bug)
Each per-slide iframe is built via buildSrcdoc(..., { initialSlideIndex: index }), which injects a generic navigation bridge (apps/web/src/runtime/srcdoc.ts) that calls gotoIndex(initialSlideIndex) a short delay after the bridge itself initializes (its slide-observer starts up, then a 100ms timer fires restoreInitialSlide() → gotoIndex()). To decide whether the deck actually moved, activeIndex() falls through several detection heuristics - scroll position, a deck-stage custom-element API, a CSS-transform track, findActiveByClass (looks for .active/.is-active/.current directly on the .slide element) - and, as the last resort, findActiveByVisibility():
function findActiveByVisibility(list){
for (var i=0; i<list.length; i++) {
var cs = window.getComputedStyle(list[i]);
if (cs.display !== 'none' && cs.visibility !== 'hidden' && cs.opacity !== '0') return i;
}
return -1;
}reveal.js drives the actual visible slide by toggling .present / .past / .future on the parent <section>, and its hide/show behavior lives one level above the .slide-classed element OpenDesign recognizes (DECK_EXPLICIT_SLIDE_SELECTOR matches .slide, which in a reveal.js deck is nested inside the <section> reveal.js actually controls). The .slide element's own computed display/opacity never reflect that parent's reveal.js state, and findActiveByVisibility() only ever reads the .slide element itself - it never reads the <section> that actually carries .present. So it reports index 0 unconditionally, no matter which section reveal.js currently has marked .present.
I verified this live in a plain browser tab against the attached repro (real, unmodified reveal.js from the CDN, loaded outside of OpenDesign entirely - this is a pure DOM fact about reveal.js + this detection heuristic, not something introduced by the OpenDesign build):
{
"sectionClasses": ["present", "future", "future"],
"mainOwnStyles": [
{ "display": "flex", "visibility": "visible", "opacity": "1", "text": "Slide 1 - Welcome" },
{ "display": "flex", "visibility": "visible", "opacity": "1", "text": "Slide 2 - Roadmap" },
{ "display": "flex", "visibility": "visible", "opacity": "1", "text": "Slide 3 - Wrap-up" }
]
}All three .slide elements report identical display/visibility/opacity regardless of which <section> is .present. reveal.js's own DOM state here is entirely correct - the three sections genuinely differ (present vs future); this is specifically a case of OpenDesign's detection not looking at the element that actually carries the state.
Because activeIndex() can never observe a change, none of gotoIndex()'s navigation attempts (goViaArtifactIndex, then stepToIndexViaKeys, then the canSetActive()/setActive() class-toggle fallback) can be confirmed as successful from the host side. In the real product, every one of the N per-slide iframes visibly renders slide 1's content - I want to flag that I'm reporting that as a direct product observation (the original screenshot), not something I re-derived purely from reading the bridge's retry logic; the DOM evidence above explains why the host can never tell the difference, which is consistent with, but doesn't by itself prove, the exact internal sequence that lands every iframe back on slide 1.
The main preview pane doesn't show this bug because it's a single, persistently running reveal.js document responding to real click/keyboard input through reveal.js's own engine, not N independent snapshot documents each needing an index imposed and verified from outside.
Why this happens in practice, not just in theory
design-templates/AGENTS.md → "Deck preview navigation contract" documents the convention OpenDesign's own deck templates follow: "keep the visible slide marked with .slide.active... OpenDesign's preview bridge reads this state." That's exactly the findActiveByClass path, and it works for decks that follow the full contract. This bug surfaces when a deck only matches the static half of that contract - its slide content sits inside a .slide-class wrapper (presumably because that's what the generation prompt/spec asks for) - while the dynamic half (keeping .active in sync with the visible slide) never happens on that element at all, because a genuinely separate, real navigation engine - reveal.js - owns visibility one DOM level higher up and has no reason to know about OpenDesign's .active convention. That combination is a plausible, not contrived, output for a coding agent that decides to reach for a real presentation library.
Related issues
The same subsystem (activeIndex() / the generic deck-navigation bridge in srcdoc.ts) has had a few similar heuristic-coverage gaps before, each for a different deck convention:
- #18 - transform-based pagination on the parent track defeated the class/visibility heuristics of the time
- #3562 - a nested horizontal scroll container wasn't recognized, so the transform fallback blanked the preview
- #3563 - a custom plain-text page counter (
#deck-counter) wasn't among the counter shapes the bridge knew how to update
I'm not asserting those specific gaps are still open today - some may already be covered by more recent additions (e.g. transform-track and nested-scroll detection). I'm citing them as precedent that this subsystem has repeatedly needed new heuristics as new deck conventions show up, and this report is another instance of that same pattern, specifically for "an ancestor of the .slide element controls real visibility."
Suggested fix direction
Not prescribing the exact fix, but two directions seem reasonable and could be combined:
- Make
findActiveByVisibility()walk up the ancestor chain (bounded at the deck container) and check each ancestor's owndisplay/visibility/opacity, not just the.slideelement's. Noteopacitydoes not inherit into a child's computed style, so an ancestor'sopacity: 0has to be checked explicitly at that ancestor, not assumed to show up on the descendant. (AgetBoundingClientRect()/offsetParentbased check does not reliably distinguish active from inactive here - reveal.js sets an inlinedisplay: blockon every<section>and stacks them at the same position, so both present and non-present sections report non-zero size and a non-nulloffsetParent; I verified this directly against the repro and it would be worth ruling that approach out explicitly rather than rediscovering it.) - Give reveal.js first-class recognition similar to
deck-stage- detect.reveal > .slides > sectionand drive/read navigation throughwindow.Reveal's own public API (Reveal.slide(h, v), theslidechangedevent,getIndices()/getCurrentSlide()). This would need to handle horizontal/vertical slide stacks, subscribe toslidechangeddirectly (rather than only depending on the existing.slide-scopedMutationObserverinobserveSlides(), which wouldn't fire on a<section>-level class change), and map reveal.js's(h, v)indexing back onto OpenDesign's flat.slideindex.
Environment
- OpenDesign version: 0.20.2 (release-stable channel, macOS build)
- Platform: macOS (Apple Silicon)
- Skill / design system: not applicable - the failing deck was freely authored HTML using a real reveal.js build, not one of OpenDesign's own
design-templates/
Minimal reproduction (index.html)
Placeholder content only, no business/company data. Loads reveal.js from a public CDN for authenticity (real, unmodified reveal.js - not a stand-in).
index.html<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>OpenDesign deck-thumbnail repro (reveal.js)</title>
<!--
Minimal reproduction for: "Deck thumbnail rail shows the first slide's
content for every slide when the deck uses reveal.js for navigation."
OpenDesign's own documented convention (design-templates/AGENTS.md
-> "Deck preview navigation contract") calls for slide content to
sit inside a `.slide`-class element that ALSO gets an `.active`
class kept in sync with the visible slide -- that combined
`.slide.active` state is what the host's generic thumbnail/
navigation bridge actually reads. This file only satisfies the
static half of that: slide content sits inside a `.slide` element,
but the `.active` half is never applied to it, because a *real*,
unmodified reveal.js (loaded from a public CDN) owns slide
switching instead. reveal.js toggles `.present` / `.past` /
`.future` on the *parent* <section> -- one level above `.slide` --
and (in current reveal.js builds) sets an inline `style.display` on
every section regardless of state, so the real hide/show happens
through stacking, not `display`. Either way, the host's
active-slide detection never sees a per-slide change on the
`.slide` element it actually inspects.
Note on the stylesheet <link> tags below: they make OpenDesign's
static-thumbnail parser reject this file for a different reason
(`external-stylesheet`) than the one hit by the original report,
where the same CSS was inlined via <style> and tripped an ordinary
`@media (min-width/max-width: ...)` rule (`viewport-media-query`).
Both checks are independent and either one alone is enough to force
the per-slide <iframe> fallback this bug lives in -- see the linked
issue body for both being verified separately. Using <link> here
keeps this reproduction small instead of inlining reveal.js's ~50KB
official stylesheet.
-->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/reveal.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/theme/black.css">
<style>
main.slide {
width: 960px;
height: 540px;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 12px;
}
main.slide h1 { font-size: 44px; margin: 0; }
</style>
</head>
<body>
<div class="reveal">
<div class="slides">
<section data-slide-id="01">
<main class="slide">
<h1>Slide 1 - Welcome</h1>
<p>Placeholder cover content.</p>
</main>
</section>
<section data-slide-id="02">
<main class="slide">
<h1>Slide 2 - Roadmap</h1>
<p>Placeholder body content, deliberately different from slide 1.</p>
</main>
</section>
<section data-slide-id="03">
<main class="slide">
<h1>Slide 3 - Wrap-up</h1>
<p>Placeholder closing content, deliberately different from slides 1-2.</p>
</main>
</section>
</div>
</div>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/reveal.js"></script>
<script>
Reveal.initialize({
width: 960,
height: 540,
controls: true,
progress: true,
transition: 'none',
hash: true
});
</script>
</body>
</html>
Source: nexu-io/open-design