Skip to content

fix: hide pages until fully composed to eliminate flash of unstyled content - #428

Merged
rich-iannone merged 4 commits into
mainfrom
fix-page-load-flash
Oct 23, 2026
Merged

rich-iannone merged 4 commits into
mainfrom
fix-page-load-flash

Conversation

@rich-iannone

Copy link
Copy Markdown
Member

When navigating between pages, I noticed a few FOUT-like things (the navbar would disappear and reappear, the sidebar would briefly show unstyled links without headers or icons, and the "On This Page" header would pop in last). This happened because theme-init.js runs from include-in-header, which Quarto places after <body>, not inside the <head>.

This PR fixes this with an inline <style> in the metadata.html Pandoc partial now hides the page before any body content renders. The previous approach used visibility: hidden, but child elements with visibility: visible !important (sidebar sections, TOC) could leak through, so the fix also adds opacity: 0 on <body> which children cannot override. A double requestAnimationFrame in the reveal ensures after-body scripts (sidebar, dark-mode toggle, tags, etc.) have painted before the page becomes visible. A <noscript> fallback keeps pages visible when JavaScript is disabled.

Note that this fix doesn't address keeping the navbar on the screen while loading a new page. That's something that could be done in a separate PR (more involved of a fix).

@github-actions

Copy link
Copy Markdown

📚 Preview this PR's docs locally

Fetch the just-built site and open it in your browser:

# this exact build
great-docs preview --run 40018743924

# or always the latest build for this PR
great-docs preview --pr 428
Auth & tips
  • Requires great-docs: pip install great-docs (or run via pipx/uvx).
  • Auth: run gh auth login then add --use-gh, or set GITHUB_TOKEN (needs Actions: read).
  • Jump to a page: add --path reference/index.html.
  • Latest vs exact: --pr <n> grabs the newest build; --run <id> pins this one.
  • Re-download: --refresh ignores the local cache.

@rich-iannone
rich-iannone merged commit dfa95f3 into main Oct 23, 2026
8 checks passed
@rich-iannone
rich-iannone deleted the fix-page-load-flash branch October 23, 2026 21:09
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