Skip to content

notification: variant icon renders invisible when the element is client-rendered (SVG children in the HTML namespace) #88

Description

@eddyloewen

Goal

The default variant icon of `el-notification` is visible whether the element was server-rendered or created in the browser.

Context

`variantIconTemplate()` nests a template result (`${paths[this.variant] ?? info}`) inside an ``. When the element renders in the browser (a toast, or a notification added after a form action), the nested `` / `` nodes end up in the HTML namespace (`namespaceURI` is `http://www.w3.org/1999/xhtml\`), so the browser draws nothing: a 20×20 empty box. Server-rendered notifications (Declarative Shadow DOM from `@webtides/element-js-ssr-renderer`) are parsed by the browser and show the icon. Seen in loewen-digital/sveltekit-ai-starter-template (issue #10 there), where inline alerts after a form submit and all toasts lose their icon; the template slots its own icon until this is fixed.

Acceptance criteria

  • A notification created with `document.createElement('el-notification')` (or rendered by a framework) shows the variant icon.
  • Server-rendered notifications keep showing it.

Proposal (non-binding)

Render the whole `` per variant as one template (no nested template result inside the SVG), or create the nested nodes with `createElementNS`. This may be an element-js concern (template parts inside SVG) rather than a notification one.

Out of scope

Custom icons passed through the `icon` slot, which work.

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