Vanilla Breeze v0.7.4

Vanilla Breeze v0.7.4 released

0.7.4 gives the Ambient pack weather. A page names one feed URL on its own site, and the pack sets data-weather from it, uses its sunrise and sunset for dawn and dusk, and never shows a stale observation. Helpers for producing the feed from Open-Meteo are included. Ambient p…

Read the release notes

comment-thread

Persistent threaded-discussion container. Decorates author-rendered <article data-comment> children with header, action row, and threaded indentation. Composes <comment-box> (reply form) and bubbles <reaction-bar> events naturally.

Overview

<comment-thread> is the container primitive for a persistent, threaded discussion. Authors render comments as <article data-comment> children with metadata attributes; the component decorates each one with an author header, relative timestamp, action toolbar (Reply / Edit / Delete), and threaded indentation via data-parent.

The component is presentational with respect to persistence: action clicks emit events, and authors call addComment / updateComment / removeComment after the server confirms.

When to use which primitive

Use thisWhen
<comment-thread>Threaded, persistent discussion attached to an item. Comments have authors + timestamps + replies + reactions + edit/delete.
<comment-wc>Single inline action button used by <selection-menu> for adding a comment to selected text. Different role — we keep both.
<comment-box>The reply / new-comment form. <comment-thread> consumes it as the reply-form template.
<chat-thread>Real-time chat (sender-grouped, ephemeral). Different interaction model from threaded comments.

Author surface

Render comments as direct <article data-comment> children. Put the rendered body in an element marked data-comment-body (any element: <section>, <div>, …). Provide a <template data-reply-form> that wraps a <comment-box> — the component clones it under whichever comment is being replied to.

Comment attributes

AttributeDescription
idStable comment id (used in events + parent refs).
data-authorDisplay name.
data-author-hrefOptional link to the author's profile. Only http(s) and relative URLs become a link; anything else (e.g. javascript:) renders as plain text.
data-author-avatarOptional avatar URL (renders <user-avatar>).
data-timeISO-8601 timestamp; rendered as relative ("2 hours ago", localized with Intl.RelativeTimeFormat in the element's lang) with the absolute time on hover. An unparseable value is shown as written.
data-mineCurrent user authored this — enables Edit / Delete actions and accent styling.
data-parentId of the parent comment for nested replies (drives indent depth).
data-editedOptional ISO timestamp; renders an "(edited)" badge with the absolute time on hover.

Wiring the backend

Hook the events; call back via the imperative API.

Reply contract

comment-thread:reply is cancelable and follows <comment-box>'s submit contract. Decide inside the handler (it is dispatched synchronously):

  • Do nothing — the reply form closes and focus returns to the comment's Reply button.
  • e.detail.waitUntil(promise) — the form stays open and busy; it closes when the promise resolves and keeps the text when it rejects.
  • e.preventDefault() — the form stays open with its text.

New replies are inserted after the parent's last descendant, so a thread reads in order without re-sorting.

Per-comment reactions bubble up as reaction-bar:toggle events — the thread doesn't intercept them. Wire them once at the thread level.

Read-only mode

Set data-disabled on the thread to hide all action toolbars (no Reply / Edit / Delete). Reactions still render but stay clickable unless the inner <reaction-bar> elements also carry data-disabled.

Accessibility

  • Thread: role="region" with the host's aria-label ("Comments" by default).
  • Comments: native <article> role, each named from its author and time via aria-labelledby (e.g. “Ada Lovelace, 2 hours ago”) so article navigation lists something meaningful. Nesting depth is visual only (indentation); the article role does not expose a level, so write reply context into the content if it matters.
  • Action buttons: in a labelled group (“Comment actions”), each named for its comment with author and absolute time (“Reply to Ada Lovelace from May 14, 2026, 8:00 AM”, “Edit your comment from …”), so repeated buttons are distinguishable.
  • Times: <time datetime> with the absolute timestamp in title; component refreshes the relative text every 60s.
  • Reply form: focus moves into the editor when shown; when the form closes (Cancel or a successful reply) focus returns to that comment's Reply button. The editor is named “Reply to <author>” unless the template's <comment-box> sets label. (<comment-box> handles its own keyboard.)

Attributes

AttributeTypeDefaultDescription
aria-labelstringCommentsRegion label.
data-disabledbooleanfalseRead-only mode — hides the action toolbar on every comment.

Events

EventBubblesDetail
comment-thread:replyyes (cancelable){ parentId, value, waitUntil(promise) }
comment-thread:edit-requestyes{ commentId, value }
comment-thread:delete-requestyes{ commentId }

Reactions bubble naturally via reaction-bar:toggle from each per-comment <reaction-bar>.

JavaScript API

MethodDescription
addComment(data)Insert a new comment. data: { id, author, time, bodyText? | bodyHtml?, parentId?, mine?, authorHref?, authorAvatar?, edited? }. A reply goes after its parent's last descendant. Returns the <article>.
updateComment(id, patch)Patch a comment. patch: { bodyText? | bodyHtml?, author?, edited? }.
removeComment(id)Remove a comment from the thread.

See also

  • <comment-box> — the reply form (composed via the <template data-reply-form>).
  • <comment-wc> — single inline action used by <selection-menu>. Different role; both ship.
  • <reaction-bar> — per-comment emoji reactions.
  • <markdown-viewer> — for rendering the comment body server-side or client-side.
↑