<section class="cap-flags" data-cap="flag-list" aria-labelledby="fl-h" data-owner data-owner-name="Alex Rivera"
data-viewer="Alex Rivera" data-text-source="#draft">
<header class="cap-flags-head">
<h2 class="cap-flags-title" id="fl-h">Flags on this draft</h2>
<p class="cap-flags-summary" data-cap-part="summary">2 blocking, 3 advisory, 4 resolved</p>
<fieldset class="cap-seg cap-flags-filter" data-cap-part="filter">
<legend class="cap-sr-only">Show</legend>
<div class="cap-seg-options" data-size="sm">
<label><input type="radio" name="fl-filter" value="open" checked /> Open<span class="cap-flags-count" data-count="open">5</span></label>
<label><input type="radio" name="fl-filter" value="resolved" /> Resolved<span class="cap-flags-count" data-count="resolved">2</span></label>
<label><input type="radio" name="fl-filter" value="all" /> All<span class="cap-flags-count" data-count="all">7</span></label>
</div>
</fieldset>
<div class="cap-flags-batch">
<button type="button" class="cap-btn" data-variant="primary" data-cap-part="apply-all">Apply 2 suggestions</button>
</div>
</header>
<ul class="cap-rows cap-flags-list" data-cap="row-list" role="list" aria-labelledby="fl-h">
<li class="cap-flag-group" data-group="blocking">
<div class="cap-flag-group-head"><h3 class="cap-flag-group-title" id="fl-g-b">Blocking</h3><span class="cap-flag-group-count">1 open, 1 resolved</span></div>
<ul class="cap-flag-group-rows" role="list" aria-labelledby="fl-g-b">
<li class="cap-row cap-flag" id="f1" data-flag="f1" data-kind="blocking" data-state="open" data-anchor="found" data-anchor-id="p-claim" data-tone="crit">
<span class="cap-row-status" id="f1-s">[critical glyph] Blocking</span>
<div class="cap-row-title"><a href="#p-claim" aria-describedby="f1-s f1-d"><span class="cap-flag-message">This claim has no source</span> <span class="cap-flag-goto">Go to passage</span></a></div>
<p class="cap-row-detail" id="f1-d">Sources check. Cause: <span data-cap-part="cause">Every factual claim needs a source or a date.</span></p>
<span class="cap-row-meta"></span>
<div class="cap-row-actions">
<button type="button" class="cap-btn" data-size="sm" data-cap-part="resolve">Resolve<span class="cap-sr-only"> flag: This claim has no source</span></button>
<button type="button" class="cap-btn" data-size="sm" data-variant="quiet" data-cap-part="dismiss">Dismiss<span class="cap-sr-only"> flag: This claim has no source</span></button>
</div>
<div class="cap-flag-body">
<blockquote class="cap-flag-quote"><p class="cap-flag-anchor-note" data-cap-part="anchor-note">Raised on this passage:</p><p><span class="cap-sr-only">Quoted passage: </span><q class="cap-flag-quote-text">Roughly 40% of the alerts were false alarms</q></p></blockquote>
<!-- A suggestion, inert until the owner applies it: -->
<div class="cap-flag-suggestion" data-state="inert">
<p class="cap-flag-suggestion-head">Suggested by Spelling check</p>
<div class="cap-flag-diff">
<del><span class="cap-flag-mark" aria-hidden="true">−</span><span class="cap-sr-only">Before: </span>Recieved wisdom</del>
<ins><span class="cap-flag-mark" aria-hidden="true">+</span><span class="cap-sr-only">After: </span><span class="cap-flag-after-text">Received wisdom</span></ins>
</div>
<div class="cap-flag-suggestion-foot" data-cap-part="suggestion-foot">
<button type="button" class="cap-btn" data-size="sm" data-variant="primary" data-cap-part="apply">Apply<span class="cap-sr-only"> suggestion: Spelling</span></button>
</div>
</div>
</div>
</li>
</ul>
</li>
<!-- the Advisory group, then three .cap-flags-empty items, one per filter, shown by CSS when it has nothing -->
</ul>
<div class="cap-sr-only" role="status" data-cap-part="live"></div>
</section>
import { enhance, attachFlagList, groupFlags, countFlags, anchorStatus, applySuggestion, revertSuggestion } from "capsomer/behavior/flag-list";
enhance(); // reads data-text-source (a textarea's value, or an element's text) to keep the anchors true
// A rich editor (CodeMirror): say how to read and write its text.
const handle = attachFlagList(section, { getText: () => view.state.doc.toString(), setText: (t) => view.dispatch({ changes: { from: 0, to: view.state.doc.length, insert: t } }) });
view.dom.addEventListener("input", handle.refresh);
section.addEventListener("cap:flag-change", (e) => save(e.detail)); // { id, state, resolution, resolvedBy, resolvedAt }
anchorStatus(flag, text); // "found" | "lost" | "none"
applySuggestion(text, flag); // the new text, or null when the anchor has gone
groupFlags(flags); // { blocking, advisory }, open first
countFlags(flags); // { blocking, advisory, open, resolved, total } (blocking and advisory are open ones)
import { FlagList, Flag } from "capsomer/react/flag-list";
import { useMessage } from "capsomer/react/message";
const { say, fail } = useMessage();
<FlagList label="Flags on this draft" flags={flags} text={draft} onTextChange={setDraft} owner ownerName="Alex Rivera" viewer="Alex Rivera" say={say} fail={fail} onFlagsChange={save} />
Examples
Seen by someone who is not the owner, with the record (All) shown
<section class="cap-flags" data-cap="flag-list" id="fl-guest" aria-labelledby="fl-guest-h" data-owner-name="Alex Rivera" data-viewer="Rosa Park" data-cap-now="2026-10-02T10:00:00Z">
<header class="cap-flags-head">
<h2 class="cap-flags-title" id="fl-guest-h">Flags on this draft, as Rosa sees them</h2>
<p class="cap-flags-summary" data-cap-part="summary">1 blocking, 1 advisory, 2 resolved</p>
<fieldset class="cap-seg cap-flags-filter" data-cap-part="filter">
<legend class="cap-sr-only">Show</legend>
<div class="cap-seg-options" data-size="sm">
<label><input type="radio" name="fl-guest-filter" value="open" /> Open<span class="cap-flags-count" data-count="open">2</span></label>
<label><input type="radio" name="fl-guest-filter" value="resolved" /> Resolved<span class="cap-flags-count" data-count="resolved">2</span></label>
<label><input type="radio" name="fl-guest-filter" value="all" checked /> All<span class="cap-flags-count" data-count="all">4</span></label>
</div>
</fieldset>
<div class="cap-flags-batch">
<button type="button" class="cap-btn" data-variant="primary" data-cap-part="apply-all" hidden>Apply 1 suggestion</button>
<p class="cap-flags-note" data-cap-part="owner-note">1 suggestion is waiting for the owner, Alex Rivera. Only they can apply them.</p>
</div>
</header>
<ul class="cap-rows cap-flags-list" data-cap="row-list" role="list" aria-labelledby="fl-guest-h">
<li class="cap-flag-group" data-group="blocking">
<div class="cap-flag-group-head"><h3 class="cap-flag-group-title" id="fl-guest-g-blocking">Blocking</h3><span class="cap-flag-group-count">1 open, 1 resolved</span></div>
<ul class="cap-flag-group-rows" role="list" aria-labelledby="fl-guest-g-blocking">
<li class="cap-row cap-flag" id="fl-guest-f1" data-flag="f1" data-kind="blocking" data-state="open" data-anchor="found" data-anchor-id="fl-draft" data-tone="crit">
<span class="cap-row-status" id="fl-guest-f1-s"><span class="cap-status" data-tone="crit"><svg class="cap-status-glyph" viewBox="0 0 16 16" aria-hidden="true" focusable="false"><path fill="currentColor" fill-rule="evenodd" d="M5 1h6l4 4v6l-4 4H5l-4-4V5zM7.2 4h1.6v5H7.2zM7.2 10.4h1.6V12H7.2z"/></svg>Blocking</span></span>
<div class="cap-row-title"><a href="#fl-draft" aria-describedby="fl-guest-f1-s fl-guest-f1-d"><span class="cap-flag-message">This claim has no source</span> <span class="cap-flag-goto">Go to passage</span></a></div>
<p class="cap-row-detail" id="fl-guest-f1-d">Sources check. Cause: <span data-cap-part="cause">Every factual claim needs a source or a date.</span></p>
<span class="cap-row-meta"></span>
<div class="cap-row-actions"><button type="button" class="cap-btn" data-size="sm" data-cap-part="resolve">Resolve<span class="cap-sr-only"> flag: This claim has no source</span></button><button type="button" class="cap-btn" data-size="sm" data-variant="quiet" data-cap-part="dismiss">Dismiss<span class="cap-sr-only"> flag: This claim has no source</span></button></div>
<div class="cap-flag-body"><blockquote class="cap-flag-quote"><p class="cap-flag-anchor-note" data-cap-part="anchor-note">Raised on this passage:</p><p><span class="cap-sr-only">Quoted passage: </span><q class="cap-flag-quote-text">Roughly 40% of the alerts last quarter were false alarms</q></p></blockquote></div>
</li>
<li class="cap-row cap-flag" id="fl-guest-f6" data-flag="f6" data-kind="blocking" data-state="resolved" data-anchor="found" data-anchor-id="fl-draft" data-resolution="resolved" data-resolved-by="Rosa Park" data-resolved-at="2026-10-02T07:30:00Z">
<span class="cap-row-status" id="fl-guest-f6-s"><span class="cap-status" data-tone="crit"><svg class="cap-status-glyph" viewBox="0 0 16 16" aria-hidden="true" focusable="false"><path fill="currentColor" fill-rule="evenodd" d="M5 1h6l4 4v6l-4 4H5l-4-4V5zM7.2 4h1.6v5H7.2zM7.2 10.4h1.6V12H7.2z"/></svg>Blocking</span></span>
<div class="cap-row-title"><a href="#fl-draft" aria-describedby="fl-guest-f6-s fl-guest-f6-d"><span class="cap-flag-message">The quoted review has no date</span> <span class="cap-flag-goto">Go to passage</span></a></div>
<p class="cap-row-detail" id="fl-guest-f6-d">Sources check. Cause: <span data-cap-part="cause">A quotation names its source and date.</span></p>
<span class="cap-row-meta"><span class="cap-status" data-tone="ok"><svg class="cap-status-glyph" viewBox="0 0 16 16" aria-hidden="true" focusable="false"><path fill="currentColor" fill-rule="evenodd" d="M8 1a7 7 0 1 0 0 14A7 7 0 1 0 8 1zM3.9 9l3 3 5.2-5.6-1.4-1.4-3.8 4.2-1.6-1.6z"/></svg>Resolved</span></span>
<div class="cap-row-actions"><button type="button" class="cap-btn" data-size="sm" data-cap-part="reopen">Reopen<span class="cap-sr-only"> flag: The quoted review has no date</span></button></div>
<div class="cap-flag-body"><blockquote class="cap-flag-quote"><p class="cap-flag-anchor-note" data-cap-part="anchor-note">Raised on this passage:</p><p><span class="cap-sr-only">Quoted passage: </span><q class="cap-flag-quote-text">Rosa reviewed it and said it was fine</q></p></blockquote><p class="cap-flag-resolution">Resolved by Rosa Park <time class="cap-time" data-cap="time" datetime="2026-10-02T07:30:00Z">2 hours ago</time>.</p></div>
</li>
</ul>
</li>
<li class="cap-flag-group" data-group="advisory">
<div class="cap-flag-group-head"><h3 class="cap-flag-group-title" id="fl-guest-g-advisory">Advisory</h3><span class="cap-flag-group-count">1 open, 1 resolved</span></div>
<ul class="cap-flag-group-rows" role="list" aria-labelledby="fl-guest-g-advisory">
<li class="cap-row cap-flag" id="fl-guest-f3" data-flag="f3" data-kind="advisory" data-state="open" data-anchor="found" data-anchor-id="fl-draft">
<span class="cap-row-status" id="fl-guest-f3-s"><span class="cap-status" data-tone="warn"><svg class="cap-status-glyph" viewBox="0 0 16 16" aria-hidden="true" focusable="false"><path fill="currentColor" fill-rule="evenodd" d="M8 1.2 15.4 14H.6zM7.3 6h1.4v4H7.3zM7.3 11h1.4v1.4H7.3z"/></svg>Advisory</span></span>
<div class="cap-row-title"><a href="#fl-draft" aria-describedby="fl-guest-f3-s fl-guest-f3-d"><span class="cap-flag-message">Spelling: Recieved</span> <span class="cap-flag-goto">Go to passage</span></a></div>
<p class="cap-row-detail" id="fl-guest-f3-d">Spelling check. Cause: <span data-cap-part="cause">Words are spelt as the dictionary spells them.</span></p>
<span class="cap-row-meta"></span>
<div class="cap-row-actions"><button type="button" class="cap-btn" data-size="sm" data-cap-part="resolve">Resolve<span class="cap-sr-only"> flag: Spelling: Recieved</span></button><button type="button" class="cap-btn" data-size="sm" data-variant="quiet" data-cap-part="dismiss">Dismiss<span class="cap-sr-only"> flag: Spelling: Recieved</span></button></div>
<div class="cap-flag-body"><blockquote class="cap-flag-quote"><p class="cap-flag-anchor-note" data-cap-part="anchor-note">Raised on this passage:</p><p><span class="cap-sr-only">Quoted passage: </span><q class="cap-flag-quote-text">Recieved wisdom</q></p></blockquote><div class="cap-flag-suggestion" data-state="inert"><p class="cap-flag-suggestion-head">Suggested by Spelling check</p><div class="cap-flag-diff"><del><span class="cap-flag-mark" aria-hidden="true">−</span><span class="cap-sr-only">Before: </span>Recieved wisdom</del><ins><span class="cap-flag-mark" aria-hidden="true">+</span><span class="cap-sr-only">After: </span><span class="cap-flag-after-text">Received wisdom</span></ins></div><div class="cap-flag-suggestion-foot" data-cap-part="suggestion-foot"><p class="cap-flag-note">Only the owner, Alex Rivera, can apply this. The draft stays as it is until they do.</p></div></div></div>
</li>
<li class="cap-row cap-flag" id="fl-guest-f7" data-flag="f7" data-kind="advisory" data-state="resolved" data-anchor="found" data-anchor-id="fl-draft" data-resolution="dismissed" data-resolved-by="Alex Rivera" data-resolved-at="2026-10-01T15:00:00Z">
<span class="cap-row-status" id="fl-guest-f7-s"><span class="cap-status" data-tone="warn"><svg class="cap-status-glyph" viewBox="0 0 16 16" aria-hidden="true" focusable="false"><path fill="currentColor" fill-rule="evenodd" d="M8 1.2 15.4 14H.6zM7.3 6h1.4v4H7.3zM7.3 11h1.4v1.4H7.3z"/></svg>Advisory</span></span>
<div class="cap-row-title"><a href="#fl-draft" aria-describedby="fl-guest-f7-s fl-guest-f7-d"><span class="cap-flag-message">14 sites differs from the sites page</span> <span class="cap-flag-goto">Go to passage</span></a></div>
<p class="cap-row-detail" id="fl-guest-f7-d">Continuity reviewer (AI). Cause: <span data-cap-part="cause">Numbers agree with the page they name.</span></p>
<span class="cap-row-meta"><span class="cap-status" data-tone="nodata"><svg class="cap-status-glyph" viewBox="0 0 16 16" aria-hidden="true" focusable="false"><circle cx="8" cy="8" r="6.2" fill="none" stroke="currentColor" stroke-width="1.6"/><path d="M5 8h6" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round"/></svg>Dismissed</span></span>
<div class="cap-row-actions"><button type="button" class="cap-btn" data-size="sm" data-cap-part="reopen">Reopen<span class="cap-sr-only"> flag: 14 sites differs from the sites page</span></button></div>
<div class="cap-flag-body"><blockquote class="cap-flag-quote"><p class="cap-flag-anchor-note" data-cap-part="anchor-note">Raised on this passage:</p><p><span class="cap-sr-only">Quoted passage: </span><q class="cap-flag-quote-text">The tool watches 14 sites</q></p></blockquote><p class="cap-flag-resolution">Dismissed by Alex Rivera <time class="cap-time" data-cap="time" datetime="2026-10-01T15:00:00Z">yesterday</time>.</p></div>
</li>
</ul>
</li>
<li class="cap-flags-empty" data-for="open">No open flags.</li>
<li class="cap-flags-empty" data-for="resolved">Nothing resolved yet.</li>
<li class="cap-flags-empty" data-for="all">No flags on this draft.</li>
</ul>
<div class="cap-sr-only" role="status" data-cap-part="live"></div>
</section>
Nothing open: the record stays
<section class="cap-flags" data-cap="flag-list" id="fl-done" aria-labelledby="fl-done-h" data-owner data-owner-name="Alex Rivera" data-viewer="Alex Rivera" data-cap-now="2026-10-02T10:00:00Z">
<header class="cap-flags-head">
<h2 class="cap-flags-title" id="fl-done-h">Flags on the colophon page</h2>
<p class="cap-flags-summary" data-cap-part="summary">No open flags, 2 resolved</p>
<fieldset class="cap-seg cap-flags-filter" data-cap-part="filter">
<legend class="cap-sr-only">Show</legend>
<div class="cap-seg-options" data-size="sm">
<label><input type="radio" name="fl-done-filter" value="open" checked /> Open<span class="cap-flags-count" data-count="open">0</span></label>
<label><input type="radio" name="fl-done-filter" value="resolved" /> Resolved<span class="cap-flags-count" data-count="resolved">2</span></label>
<label><input type="radio" name="fl-done-filter" value="all" /> All<span class="cap-flags-count" data-count="all">2</span></label>
</div>
</fieldset>
<div class="cap-flags-batch">
<button type="button" class="cap-btn" data-variant="primary" data-cap-part="apply-all" hidden>Apply 0 suggestions</button>
<p class="cap-flags-note" data-cap-part="owner-note" hidden>0 suggestions are waiting for the owner, Alex Rivera. Only they can apply them.</p>
</div>
</header>
<ul class="cap-rows cap-flags-list" data-cap="row-list" role="list" aria-labelledby="fl-done-h">
<li class="cap-flag-group" data-group="blocking">
<div class="cap-flag-group-head"><h3 class="cap-flag-group-title" id="fl-done-g-blocking">Blocking</h3><span class="cap-flag-group-count">0 open, 1 resolved</span></div>
<ul class="cap-flag-group-rows" role="list" aria-labelledby="fl-done-g-blocking">
<li class="cap-row cap-flag" id="fl-done-d1" data-flag="d1" data-kind="blocking" data-state="resolved" data-anchor="found" data-anchor-id="fl-draft" data-resolution="resolved" data-resolved-by="Rosa Park" data-resolved-at="2026-10-02T07:30:00Z">
<span class="cap-row-status" id="fl-done-d1-s"><span class="cap-status" data-tone="crit"><svg class="cap-status-glyph" viewBox="0 0 16 16" aria-hidden="true" focusable="false"><path fill="currentColor" fill-rule="evenodd" d="M5 1h6l4 4v6l-4 4H5l-4-4V5zM7.2 4h1.6v5H7.2zM7.2 10.4h1.6V12H7.2z"/></svg>Blocking</span></span>
<div class="cap-row-title"><a href="#fl-draft" aria-describedby="fl-done-d1-s fl-done-d1-d"><span class="cap-flag-message">The quoted review has no date</span> <span class="cap-flag-goto">Go to passage</span></a></div>
<p class="cap-row-detail" id="fl-done-d1-d">Sources check. Cause: <span data-cap-part="cause">A quotation names its source and date.</span></p>
<span class="cap-row-meta"><span class="cap-status" data-tone="ok"><svg class="cap-status-glyph" viewBox="0 0 16 16" aria-hidden="true" focusable="false"><path fill="currentColor" fill-rule="evenodd" d="M8 1a7 7 0 1 0 0 14A7 7 0 1 0 8 1zM3.9 9l3 3 5.2-5.6-1.4-1.4-3.8 4.2-1.6-1.6z"/></svg>Resolved</span></span>
<div class="cap-row-actions"><button type="button" class="cap-btn" data-size="sm" data-cap-part="reopen">Reopen<span class="cap-sr-only"> flag: The quoted review has no date</span></button></div>
<div class="cap-flag-body"><blockquote class="cap-flag-quote"><p class="cap-flag-anchor-note" data-cap-part="anchor-note">Raised on this passage:</p><p><span class="cap-sr-only">Quoted passage: </span><q class="cap-flag-quote-text">Rosa reviewed it and said it was fine</q></p></blockquote><p class="cap-flag-resolution">Resolved by Rosa Park <time class="cap-time" data-cap="time" datetime="2026-10-02T07:30:00Z">2 hours ago</time>.</p></div>
</li>
</ul>
</li>
<li class="cap-flag-group" data-group="advisory">
<div class="cap-flag-group-head"><h3 class="cap-flag-group-title" id="fl-done-g-advisory">Advisory</h3><span class="cap-flag-group-count">0 open, 1 resolved</span></div>
<ul class="cap-flag-group-rows" role="list" aria-labelledby="fl-done-g-advisory">
<li class="cap-row cap-flag" id="fl-done-d2" data-flag="d2" data-kind="advisory" data-state="resolved" data-anchor="found" data-anchor-id="fl-draft" data-resolution="dismissed" data-resolved-by="Alex Rivera" data-resolved-at="2026-10-01T15:00:00Z">
<span class="cap-row-status" id="fl-done-d2-s"><span class="cap-status" data-tone="warn"><svg class="cap-status-glyph" viewBox="0 0 16 16" aria-hidden="true" focusable="false"><path fill="currentColor" fill-rule="evenodd" d="M8 1.2 15.4 14H.6zM7.3 6h1.4v4H7.3zM7.3 11h1.4v1.4H7.3z"/></svg>Advisory</span></span>
<div class="cap-row-title"><a href="#fl-draft" aria-describedby="fl-done-d2-s fl-done-d2-d"><span class="cap-flag-message">14 sites differs from the sites page</span> <span class="cap-flag-goto">Go to passage</span></a></div>
<p class="cap-row-detail" id="fl-done-d2-d">Continuity reviewer (AI). Cause: <span data-cap-part="cause">Numbers agree with the page they name.</span></p>
<span class="cap-row-meta"><span class="cap-status" data-tone="nodata"><svg class="cap-status-glyph" viewBox="0 0 16 16" aria-hidden="true" focusable="false"><circle cx="8" cy="8" r="6.2" fill="none" stroke="currentColor" stroke-width="1.6"/><path d="M5 8h6" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round"/></svg>Dismissed</span></span>
<div class="cap-row-actions"><button type="button" class="cap-btn" data-size="sm" data-cap-part="reopen">Reopen<span class="cap-sr-only"> flag: 14 sites differs from the sites page</span></button></div>
<div class="cap-flag-body"><blockquote class="cap-flag-quote"><p class="cap-flag-anchor-note" data-cap-part="anchor-note">Raised on this passage:</p><p><span class="cap-sr-only">Quoted passage: </span><q class="cap-flag-quote-text">The tool watches 14 sites</q></p></blockquote><p class="cap-flag-resolution">Dismissed by Alex Rivera <time class="cap-time" data-cap="time" datetime="2026-10-01T15:00:00Z">yesterday</time>.</p></div>
</li>
</ul>
</li>
<li class="cap-flags-empty" data-for="open">No open flags.</li>
<li class="cap-flags-empty" data-for="resolved">Nothing resolved yet.</li>
<li class="cap-flags-empty" data-for="all">No flags on this draft.</li>
</ul>
<div class="cap-sr-only" role="status" data-cap-part="live"></div>
</section>
A narrow column
<div class="flag-sample-narrow">
<section class="cap-flags" data-cap="flag-list" id="fl-phone" aria-labelledby="fl-phone-h" data-owner data-owner-name="Alex Rivera" data-viewer="Alex Rivera" data-cap-now="2026-10-02T10:00:00Z">
<header class="cap-flags-head">
<h2 class="cap-flags-title" id="fl-phone-h">Flags</h2>
<p class="cap-flags-summary" data-cap-part="summary">1 blocking, 1 advisory, 0 resolved</p>
<fieldset class="cap-seg cap-flags-filter" data-cap-part="filter">
<legend class="cap-sr-only">Show</legend>
<div class="cap-seg-options" data-size="sm">
<label><input type="radio" name="fl-phone-filter" value="open" checked /> Open<span class="cap-flags-count" data-count="open">2</span></label>
<label><input type="radio" name="fl-phone-filter" value="resolved" /> Resolved<span class="cap-flags-count" data-count="resolved">0</span></label>
<label><input type="radio" name="fl-phone-filter" value="all" /> All<span class="cap-flags-count" data-count="all">2</span></label>
</div>
</fieldset>
<div class="cap-flags-batch">
<button type="button" class="cap-btn" data-variant="primary" data-cap-part="apply-all">Apply 1 suggestion</button>
<p class="cap-flags-note" data-cap-part="owner-note" hidden>1 suggestion is waiting for the owner, Alex Rivera. Only they can apply them.</p>
</div>
</header>
<ul class="cap-rows cap-flags-list" data-cap="row-list" role="list" aria-labelledby="fl-phone-h">
<li class="cap-flag-group" data-group="blocking">
<div class="cap-flag-group-head"><h3 class="cap-flag-group-title" id="fl-phone-g-blocking">Blocking</h3><span class="cap-flag-group-count">1 open, 0 resolved</span></div>
<ul class="cap-flag-group-rows" role="list" aria-labelledby="fl-phone-g-blocking">
<li class="cap-row cap-flag" id="fl-phone-mf1" data-flag="mf1" data-kind="blocking" data-state="open" data-anchor="found" data-anchor-id="fl-draft" data-tone="crit">
<span class="cap-row-status" id="fl-phone-mf1-s"><span class="cap-status" data-tone="crit"><svg class="cap-status-glyph" viewBox="0 0 16 16" aria-hidden="true" focusable="false"><path fill="currentColor" fill-rule="evenodd" d="M5 1h6l4 4v6l-4 4H5l-4-4V5zM7.2 4h1.6v5H7.2zM7.2 10.4h1.6V12H7.2z"/></svg>Blocking</span></span>
<div class="cap-row-title"><a href="#fl-draft" aria-describedby="fl-phone-mf1-s fl-phone-mf1-d"><span class="cap-flag-message">This claim has no source</span> <span class="cap-flag-goto">Go to passage</span></a></div>
<p class="cap-row-detail" id="fl-phone-mf1-d">Sources check. Cause: <span data-cap-part="cause">Every factual claim needs a source or a date.</span></p>
<span class="cap-row-meta"></span>
<div class="cap-row-actions"><button type="button" class="cap-btn" data-size="sm" data-cap-part="resolve">Resolve<span class="cap-sr-only"> flag: This claim has no source</span></button><button type="button" class="cap-btn" data-size="sm" data-variant="quiet" data-cap-part="dismiss">Dismiss<span class="cap-sr-only"> flag: This claim has no source</span></button></div>
<div class="cap-flag-body"><blockquote class="cap-flag-quote"><p class="cap-flag-anchor-note" data-cap-part="anchor-note">Raised on this passage:</p><p><span class="cap-sr-only">Quoted passage: </span><q class="cap-flag-quote-text">Roughly 40% of the alerts last quarter were false alarms</q></p></blockquote></div>
</li>
</ul>
</li>
<li class="cap-flag-group" data-group="advisory">
<div class="cap-flag-group-head"><h3 class="cap-flag-group-title" id="fl-phone-g-advisory">Advisory</h3><span class="cap-flag-group-count">1 open, 0 resolved</span></div>
<ul class="cap-flag-group-rows" role="list" aria-labelledby="fl-phone-g-advisory">
<li class="cap-row cap-flag" id="fl-phone-mf3" data-flag="mf3" data-kind="advisory" data-state="open" data-anchor="found" data-anchor-id="fl-draft">
<span class="cap-row-status" id="fl-phone-mf3-s"><span class="cap-status" data-tone="warn"><svg class="cap-status-glyph" viewBox="0 0 16 16" aria-hidden="true" focusable="false"><path fill="currentColor" fill-rule="evenodd" d="M8 1.2 15.4 14H.6zM7.3 6h1.4v4H7.3zM7.3 11h1.4v1.4H7.3z"/></svg>Advisory</span></span>
<div class="cap-row-title"><a href="#fl-draft" aria-describedby="fl-phone-mf3-s fl-phone-mf3-d"><span class="cap-flag-message">Spelling: Recieved</span> <span class="cap-flag-goto">Go to passage</span></a></div>
<p class="cap-row-detail" id="fl-phone-mf3-d">Spelling check. Cause: <span data-cap-part="cause">Words are spelt as the dictionary spells them.</span></p>
<span class="cap-row-meta"></span>
<div class="cap-row-actions"><button type="button" class="cap-btn" data-size="sm" data-cap-part="resolve">Resolve<span class="cap-sr-only"> flag: Spelling: Recieved</span></button><button type="button" class="cap-btn" data-size="sm" data-variant="quiet" data-cap-part="dismiss">Dismiss<span class="cap-sr-only"> flag: Spelling: Recieved</span></button></div>
<div class="cap-flag-body"><blockquote class="cap-flag-quote"><p class="cap-flag-anchor-note" data-cap-part="anchor-note">Raised on this passage:</p><p><span class="cap-sr-only">Quoted passage: </span><q class="cap-flag-quote-text">Recieved wisdom</q></p></blockquote><div class="cap-flag-suggestion" data-state="inert"><p class="cap-flag-suggestion-head">Suggested by Spelling check</p><div class="cap-flag-diff"><del><span class="cap-flag-mark" aria-hidden="true">−</span><span class="cap-sr-only">Before: </span>Recieved wisdom</del><ins><span class="cap-flag-mark" aria-hidden="true">+</span><span class="cap-sr-only">After: </span><span class="cap-flag-after-text">Received wisdom</span></ins></div><div class="cap-flag-suggestion-foot" data-cap-part="suggestion-foot"><button type="button" class="cap-btn" data-size="sm" data-variant="primary" data-cap-part="apply">Apply<span class="cap-sr-only"> suggestion: Spelling: Recieved</span></button><span class="cap-flag-note">Nothing changes in the draft until you apply it.</span></div></div></div>
</li>
</ul>
</li>
<li class="cap-flags-empty" data-for="open">No open flags.</li>
<li class="cap-flags-empty" data-for="resolved">Nothing resolved yet.</li>
<li class="cap-flags-empty" data-for="all">No flags on this draft.</li>
</ul>
<div class="cap-sr-only" role="status" data-cap-part="live"></div>
</section>
</div>
Comfortable density
<div data-density="comfortable">
<section class="cap-flags" data-cap="flag-list" id="fl-comfy" aria-labelledby="fl-comfy-h" data-owner data-owner-name="Alex Rivera" data-viewer="Alex Rivera" data-cap-now="2026-10-02T10:00:00Z">
<header class="cap-flags-head">
<h2 class="cap-flags-title" id="fl-comfy-h">Flags</h2>
<p class="cap-flags-summary" data-cap-part="summary">0 blocking, 1 advisory, 0 resolved</p>
<fieldset class="cap-seg cap-flags-filter" data-cap-part="filter">
<legend class="cap-sr-only">Show</legend>
<div class="cap-seg-options" data-size="sm">
<label><input type="radio" name="fl-comfy-filter" value="open" checked /> Open<span class="cap-flags-count" data-count="open">1</span></label>
<label><input type="radio" name="fl-comfy-filter" value="resolved" /> Resolved<span class="cap-flags-count" data-count="resolved">0</span></label>
<label><input type="radio" name="fl-comfy-filter" value="all" /> All<span class="cap-flags-count" data-count="all">1</span></label>
</div>
</fieldset>
<div class="cap-flags-batch">
<button type="button" class="cap-btn" data-variant="primary" data-cap-part="apply-all" hidden>Apply 0 suggestions</button>
<p class="cap-flags-note" data-cap-part="owner-note" hidden>0 suggestions are waiting for the owner, Alex Rivera. Only they can apply them.</p>
</div>
</header>
<ul class="cap-rows cap-flags-list" data-cap="row-list" role="list" aria-labelledby="fl-comfy-h">
<li class="cap-flag-group" data-group="advisory">
<div class="cap-flag-group-head"><h3 class="cap-flag-group-title" id="fl-comfy-g-advisory">Advisory</h3><span class="cap-flag-group-count">1 open, 0 resolved</span></div>
<ul class="cap-flag-group-rows" role="list" aria-labelledby="fl-comfy-g-advisory">
<li class="cap-row cap-flag" id="fl-comfy-c5" data-flag="c5" data-kind="advisory" data-state="open" data-anchor="none">
<span class="cap-row-status" id="fl-comfy-c5-s"><span class="cap-status" data-tone="warn"><svg class="cap-status-glyph" viewBox="0 0 16 16" aria-hidden="true" focusable="false"><path fill="currentColor" fill-rule="evenodd" d="M8 1.2 15.4 14H.6zM7.3 6h1.4v4H7.3zM7.3 11h1.4v1.4H7.3z"/></svg>Advisory</span></span>
<div class="cap-row-title"><span class="cap-flag-title"><span class="cap-flag-message">The post has no summary line</span></span></div>
<p class="cap-row-detail" id="fl-comfy-c5-d">Header check. Cause: <span data-cap-part="cause">Every post has a summary for the feed.</span></p>
<span class="cap-row-meta"></span>
<div class="cap-row-actions"><button type="button" class="cap-btn" data-size="sm" data-cap-part="resolve">Resolve<span class="cap-sr-only"> flag: The post has no summary line</span></button><button type="button" class="cap-btn" data-size="sm" data-variant="quiet" data-cap-part="dismiss">Dismiss<span class="cap-sr-only"> flag: The post has no summary line</span></button></div>
<div class="cap-flag-body"></div>
</li>
</ul>
</li>
<li class="cap-flags-empty" data-for="open">No open flags.</li>
<li class="cap-flags-empty" data-for="resolved">Nothing resolved yet.</li>
<li class="cap-flags-empty" data-for="all">No flags on this draft.</li>
</ul>
<div class="cap-sr-only" role="status" data-cap-part="live"></div>
</section>
</div>
The React component, holding its own flags and text
<div data-mount="react"></div>
The page's message region, where Undo appears
<div class="cap-message" data-cap="message" role="status" aria-label="Results and failures" aria-atomic="false"></div>
API reference
Flag
Prop
Type
Required
Does
flag
FlagData
Yes
anchor
AnchorStatus
Yes
owner
boolean
Yes
ownerName
string
idPrefix
string
Yes
The row's id prefix, so ids are unique when several lists are on a page.
onResolve
() => void
Yes
onDismiss
() => void
Yes
onReopen
() => void
Yes
onApply
() => void
Yes
now
number
A router's link component for the passage link; a plain <a> by default.
FlagList
Prop
Type
Required
Does
label
ReactNode
Yes
The list's heading: "Flags on this draft".
flags
FlagData[]
Yes
onFlagsChange
(flags: FlagData[]) => void
Called with the whole new list after a flag is resolved, dismissed, reopened or applied.
text
string
The current text the anchors are read against, and how to write it back. Without text the flags' own anchor.lost marks are believed and Apply is not offered.
onTextChange
(text: string) => void
owner
boolean
The owner may apply suggestions; nobody else is offered the button.
ownerName
string
viewer
string
Who is resolving: written on the flag.
say
(text: string, opts?: SayOptions) => void
Where results are said, with Undo. Pass useMessage().say and .fail; without them the plain behavior module's region (an element with data-cap="message") is used.
fail
(text: string) => void
filter
FilterValue
primary
boolean
Make j and k work before focus is inside the list.
Functions
Function
Signature
Does
glyph
(name: string | (string & {})): SVGSVGElement
The status component's glyph, the same drawing (components/status).
A flag read back from its row, so the DOM stays the one source of truth.
flagRows
(root: ParentNode): HTMLElement[]
readFlags
(root: ParentNode): Flag[]
renderFlag
(li: HTMLElement, ctx: Ctx): void
Rebuilds the parts of one row that depend on its state and anchor, from its data attributes: the critical edge, the title (a link only while the passage is there), the resolution on the right, the actions, the suggestion's footer, and the line that says who closed it and when.
Attaches to every [data-cap="flag-list"] under root not attached yet. The text the anchors are read against is the element named by data-text-source (a textarea's value, or an element's text). Returns a function that detaches them all.
Parts and data attributes
Class
Is
.cap-flag
its own class
.cap-flag-anchor-note
its own class
.cap-flag-body
its own class
.cap-flag-diff
its own class
.cap-flag-goto
its own class
.cap-flag-group
its own class
.cap-flag-group-count
its own class
.cap-flag-group-head
its own class
.cap-flag-group-rows
its own class
.cap-flag-group-title
its own class
.cap-flag-mark
its own class
.cap-flag-note
its own class
.cap-flag-quote
its own class
.cap-flag-quote-text
its own class
.cap-flag-resolution
its own class
.cap-flag-suggestion
its own class
.cap-flag-suggestion-foot
its own class
.cap-flag-suggestion-head
its own class
.cap-flag-title
its own class
.cap-flags
the root
.cap-flags-batch
a part
.cap-flags-count
a part
.cap-flags-empty
a part
.cap-flags-filter
a part
.cap-flags-head
a part
.cap-flags-note
a part
.cap-flags-summary
a part
.cap-flags-title
a part
Attribute
Values
data-anchor
lost
data-for
allopenresolved
data-state
appliedopenresolved
State
Read from
:checked
the platform
:empty
the platform
[hidden]
an attribute
Accessibility
Key
Does
Tab
Moves through the filter, the batch button, then each flag's link and buttons in reading order
j, k
Moves focus to the next or previous flag's link or message (when single-key shortcuts are on)
Enter on the title link
Goes to the passage (href="#anchor-id")
Enter or Space on Resolve, Dismiss or Reopen
Does it at once; focus moves to the row's next action, or the next visible row
Enter or Space on Apply
Replaces the quoted passage with the suggestion, resolves the flag, says "Suggestion applied to the draft. Undo"
Enter or Space on "Apply N suggestions"
Opens the preview dialog with focus on Cancel; Esc closes it
Arrow keys in the filter
Move between Open, Resolved and All and choose, as a radio group
z
Runs the newest Undo in the message region
The list is a named region (section labeled by its heading) holding one ul (role="list"); each group is a list item named by its heading (a list of the group's rows).
The status is a glyph, a word and a color. "Anchor lost" has the dashed glyph and the words. A resolved flag's state is the word "Resolved", "Dismissed" or "Applied" beside a glyph.
The quote is a blockquote with the hidden words "Quoted passage"; the before and after lines carry the hidden words "Before" and "After" and a plus or minus mark.
Each button's name says which flag it is for ("Resolve flag: This claim has no source"), and begins with the visible word.
The result of every action is announced politely (the message region or the list's own role="status"); a failure is an alert.
Forced colors: the dashes, rules and marks stay; the diff tints become outlines.