Skip to content

notification: server-rendered open notification is invisible until JavaScript adds .showing #87

Description

@eddyloewen

Goal

An `` rendered on the server is visible before its JavaScript runs, and stays visible when scripting is disabled.

Context

The base wrapper starts at `opacity: 0; transform: translateX(…)` and only `connected()` adds the `.showing` class that makes it visible. In Declarative Shadow DOM output from `@webtides/element-js-ssr-renderer` the markup and styles are complete, but the notification stays transparent until the element upgrades, and forever without JS. For inline status messages (a failed login, a saved-changes hint) that is the content the page is there for. Hit in loewen-digital/sveltekit-ai-starter-template (issue #10 there); the template injects `:host(:not(:state(connected))) [part~='base'] { opacity: 1; transform: none }` through the renderer's per-component `styles` until this is solved upstream.

Acceptance criteria

  • A server-rendered `` is visible with scripting disabled.
  • No flash between first paint and upgrade when scripting is enabled.
  • The enter/exit transitions with JS keep working.

Proposal (non-binding)

Treat "not yet connected" as the resting visible state, e.g. `:host(:not(:state(connected))) [part~='base'] { opacity: 1; transform: none; }` in `notification.style.js`, or derive the resting state from the reflected `[open]` attribute and only animate from a `.entering` class.

Out of scope

The toast stack, which is created client-side only.

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