Repository navigation
Stop the unstyled flash looking like injected ads - #477
Merged
Merged
Conversation
Two things painted badly in the gap before the stylesheet lands: - The header logo had no intrinsic size (marketing) or the wrong aspect (app, 320x64 for a 489x173 viewBox), so it rendered at full viewport width. Pin it to 181x64 with an inline height. - ad.js left each slot empty until /api/ads/serve answered, so the page jumped when the creative landed. It now paints a faint, theme-aware skeleton built as an inline SVG (no request) at the format's size, swapped for the iframe on fill and removed on a no-fill. A slot with the publisher's own fallback markup is left alone. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ThreatCrush Security Scan0 finding(s) in the 3 file(s) this pull request changes. Nothing in the files this pull request changes. 56 pre-existing finding(s) elsewhere in the repository — **HIGH**: 3 | **MEDIUM**: 34 | **LOW**: 19Not introduced by this pull request.
…and 36 more; the full set is in the SARIF artifact. Snippets are redacted; ThreatCrush never prints matched credential material. |
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.
During a slow stylesheet load, /ads (and every marketing page) flashed a full-viewport logo plus raw markup that read like an injected ad.
data-cp-adslot now paints a faint, theme-aware skeleton straight away, an inline SVG built in the tag (zero requests), sized to the format so the slot is reserved and nothing jumps. Swapped for the iframe on fill, removed on a no-fill, and skipped when the publisher put their own fallback markup in the container.Checked: tsc clean, vitest 3185 passed; the snippet exercised in headless Chromium with stubbed fetch (placeholder 300x250 / 728x90 / 320x50 while loading, iframe after fill, collapses on no-fill, fallback untouched).
🤖 Generated with Claude Code