Skip to content

themes: scope injected CSS under #aether-root (no global html/body leakage) #37

Open

Description

@wayback09

themes: scope injected CSS under #aether-root (no global html/body leakage)

Context

frontend/src/stores/theme.ts:19-28 injects one global <style id="aether-theme-overwrite"> via appendChild after base styles. frontend/src/style.css:1-20 tokens are global, but Sidebar.svelte:189-352, TitleBar.svelte:61-118, App.svelte:189-238 use scoped <style> (compiled to .sidebar.svelte-xxxxx). Plain global .sidebar {…} has lower specificity than scoped 0,2,0.

Problem

  • SanitizeCSS does no scoping — html {pointer-events:none} or * {position:fixed} hits the whole app.
  • Themes targeting .sidebar, .card, .btn-primary rely on grepping source; those classes are not a stable API (docs/STYLEGUIDE.md lists philosophy, not class inventory).

Fix

  • Wrap app chrome in <div id="aether-root" class="app-container"> (frontend/src/App.svelte:140).

  • In pkg/theme/protected.go:111 sanitizeRules, rewrite each kept selector: split by , → prefix with #aether-root unless already scoped. Keep @media/@supports recursion.

  • Document: themes must target #aether-root / [data-aether]; bare html/body/#app becomes no-op (already blocked for pointer-events:none).

  • Files: frontend/src/App.svelte:140, pkg/theme/protected.go:111, frontend/src/style.css:1-28

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions