Anchoring

Attaching a comment to a spot on a living web page is the hardest problem in this product. co-mment treats a pin’s position as a resolution strategy, not a stored coordinate. When a resolution is a guess, the pin says so instead of pretending.

What gets captured

When a comment is posted, the SDK captures an anchor record with three layers:

How a pin finds its way back

At render time, resolution runs in order:

  1. Exact. The selector resolves and the text fingerprint matches: the pin is placed at the stored offset inside the element.
  2. Drifted. The selector resolves but the fingerprint differs: the pin is placed at the element offset and badged “content may have changed”. The element is still there, but what it says has changed since the comment was made.
  3. Approximate. The selector fails entirely: the pin falls back to the page-relative position and is badged approximate. This is an honest guess: the element the commenter clicked no longer exists.
  4. Viewport mismatch. Independently of the above, if the current viewport differs from the captured one by more than 20% in width, the pin shows a badge with the original viewport. A comment about a mobile layout viewed on desktop can point at the wrong thing even when the element resolves perfectly.
  5. Query mismatch. Pins are matched and loaded by path alone. Query string and hash are ignored for matching, but the exact URL is stored. When the captured query differs from the current one, the pin still renders and the thread notes the original URL (“commented on ?plan=annual”). Search results and query-param routing stay visible; mismatches are labeled instead of hidden.

What this means in practice