change-set
Interactive change tracking group that wraps related ins and del elements with toggle controls for tracking, final, and original views.
Overview
The <change-set> element groups related <ins> and <del> elements into a reviewable unit. Users can toggle between three views: tracked changes (both visible), final text (only insertions), or original text (only deletions).
The view states are CSS-only via the view attribute. JavaScript adds interactive toggle buttons.
View States
| State | What's Visible | How to Set |
|---|---|---|
| Tracking (default) | Both <ins> and <del> |
No view attribute |
| Final | Only <ins> content |
view="final" |
| Original | Only <del> content |
view="original" |
Static View (No JS)
Set view directly in markup for server-rendered or static pages. No JavaScript is needed for the visual states.
Multiple Changes
A single <change-set> can group changes across multiple sections. All <ins> and <del> descendants are toggled together.
Attributes
| Attribute | Values | Default | Description |
|---|---|---|---|
view |
final, original |
Omitted (tracking) | Controls which content is visible |
datetime |
ISO 8601 date | — | Date of the change set |
author |
String | — | Author of the changes |
JavaScript API
Events
| Event | Detail | Description |
|---|---|---|
change-set:view |
{ view: string } |
Fired when the view mode changes. Bubbles. |
Accessibility
- Toggle buttons use
aria-pressedto indicate the active view - The controls
<nav>hasaria-label="Change view controls" - In final and original views, hidden content uses
display: none— it is removed from both the visual and accessibility trees - Without JavaScript, all content is visible in tracking view