Skip to content

Render Wikipedia articles with real Vector 2022 styles in Shadow DOM - #45

Merged
B0und merged 16 commits into
devfrom
styles-research
Sep 17, 2026
Merged

B0und merged 16 commits into
devfrom
styles-research

Conversation

@B0und

@B0und B0und commented Sep 14, 2026

Copy link
Copy Markdown
Owner

Summary

  • Fetch Wikipedia parse payloads with the Vector 2022 contract (modules/jsconfigvars metadata) and load compiled skins.vector.styles, Parsoid, page-conditional, and site.styles CSS through ResourceLoader URLs per language edition
  • Render article HTML inside an isolated ShadowRoot (WikiArticleSurface) with DOMPurify sanitization, style-load settlement (ready/degraded states), and loading-paused presentation
  • Scope click/keyboard delegation to the ShadowRoot content so navbox toggles, hash scrolling, winning-link counting/highlighting, and in-game navigation keep working; absolute https://{lang}.wikipedia.org/wiki/... links from live parses now route correctly
  • Add persisted, localized, responsive text-size (small/standard/large) and content-width (compact/wide) controls in the header via a shared controls body (desktop drawer, mobile popover)
  • Delete the legacy global styling path (unreset.css, vec2022base.css, vector2022.css, overrides.css, ~4.5k lines); keep only a small ShadowRoot-scoped article-adaptations.css including restored collapsible-table behavior

Verification

  • pnpm typesafe-i18n, pnpm typecheck, pnpm build pass
  • Focused browser tests pass (12 tests: ResourceLoader contract, style isolation, navbox collapse, hash/absolute navigation, presentation live-update, settings migration)
  • Live smoke tests at desktop/mobile widths against real Wikipedia: English (navbox/infobox/citations), Arabic RTL (correct host + lang=ar + dir=rtl), Japanese math article (ext.math.styles conditional URL appears), cache reuse of baseline URL between same-language articles

Test plan

  • pnpm test:browser focused suites
  • pnpm build
  • Manual smoke: start a run, click links inside the article, toggle navbox collapse, resize presentation, switch language editions

@B0und
B0und merged commit d69ffa1 into dev Sep 17, 2026
2 checks passed
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