Skip to content

feat(annotate): a slider mode for compare - #17

Merged
vite-hub[bot] merged 8 commits into
mainfrom
feat/compare-slider
Oct 20, 2026
Merged

vite-hub[bot] merged 8 commits into
mainfrom
feat/compare-slider

Conversation

@onmax

@onmax onmax commented Oct 20, 2026 •

Copy link
Copy Markdown
Owner

::compare{mode="slider"} lays the before and after screenshots over each other, with a divider the reader drags. Each screenshot gets the full width, so a small change at the same spot (a number, a label) shows up under the line instead of in two half-width images.

::compare{mode="slider"}
:::screenshot{src="before.png" alt="…" viewport="1440x900"}
:::
:::screenshot{src="after.png" alt="…" viewport="1440x900"}
:::
::

The interaction follows React Bits' Comparison Slider: a thin line with a round grip, dragging that keeps going briefly after a quick flick (off under reduced motion), and Before/After labels.

  • Pointer. A drag anywhere on the pair moves the divider; on touch, a horizontal drag moves it and a vertical one scrolls the page. A click on the screenshots that doesn't drag still zooms, and the zoomed copy is a slider too. A click on the grip doesn't zoom, since it's there to drag.
  • Keyboard. The handle is a role="slider": arrows move it 5%, Page Up/Down 25%, Home/End go to either edge. aria-valuetext reads like "Before 40%, After 60%". The zoomed copy gets its tab stop back, so it moves by key too. The zoomed copy gets its tab stop back, so it moves by key too.
  • Notes. Marks are clipped with their own screenshot, so a red box on Before turns into the green one on After as the line passes. Notes sit under the pair, each under its own side. Side notes (side=…) become numbered list notes, since an arrow would cross the divider.
  • Without the script, the two screenshots stack, each under its title, so the page still reads.
  • Validation. mode must be columns (the default, unchanged) or slider. Anything else goes to meta.issues, and mode is listed among the compare's valid props.

The slider script ships inside comark-annotate and is inlined once per document, like zoom's. There's no new package and no Vue/React/Svelte versions, since annotate only has an HTML renderer.

Docs: a Slider tab on the annotate page, a mode row under compare, and notes in the README and the agent skill.

Checks

  • Format, build, lint, typecheck, and doctor for comark-annotate pass.
  • Unit tests cover the slider markup, side notes becoming numbered notes, the script being inlined once, and the bad-mode issue.
  • A new e2e test drags the divider to 25% and checks that this doesn't zoom, moves it with End and ArrowLeft, checks that a click on the grip doesn't zoom and a click on the screenshots does, and moves the zoomed copy with Home. e2e/annotate.e2e.ts passed 16 runs locally.

Three tests in packages/annotate/test/annotate.test.ts fail, and they also fail on main at 142b3d0: two expect the old href message, and one expects the Object-key hint. pnpm ready stops there, and zoom's doctor reports a VUE0004 warning that is also on main.

🤖 Generated with Claude Code

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

🚀 Deploying Preview to Cloudflare 🚀

Preview Deployments by commit

Status Deployment URL Commit Updated (UTC) See this deployment's details
  • Build: Success ✅

View logs ↗
No Preview URL. Enable ↗ a61b4cc 2026-10-20T11:41:37.051Z Visit the dashboard ↗
  • Build: Success ✅

View logs ↗
No Preview URL. Enable ↗ 0da7470 2026-10-20T11:15:40.998Z Visit the dashboard ↗
  • Build: Success ✅

View logs ↗
No Preview URL. Enable ↗ cdb3b44 2026-10-20T10:59:24.984Z Visit the dashboard ↗
  • Build: Success ✅

View logs ↗
No Preview URL. Enable ↗ 8b49e31 2026-10-20T10:41:24.277Z Visit the dashboard ↗
  • Build: Success ✅

View logs ↗
No Preview URL. Enable ↗ 35602fb 2026-10-20T10:02:59.652Z Visit the dashboard ↗
  • Build: Success ✅

View logs ↗
No Preview URL. Enable ↗ 84cc740 2026-10-20T09:24:22.740Z Visit the dashboard ↗
  • Build: Success ✅

View logs ↗
No Preview URL. Enable ↗ 1015ffc 2026-10-20T09:01:23.018Z Visit the dashboard ↗
  • Build: Success ✅

View logs ↗
No Preview URL. Enable ↗ b01e546 2026-10-20T08:33:58.367Z Visit the dashboard ↗

@vite-hub

vite-hub Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor
Session Status Started Duration
Pending Completed Not started —
View session Completed 2026-10-20T11:55:25.342Z 2m 27s

Latest result

Pull request merged.

Final answers

Session

Pull request merged.

Session

Waiting for GitHub merge request 88c8c76d-411b-4e99-b844-9e08a9914b40.

View session

Verified HEAD and current evidence. Pullfrog touch-drag suppression remains P1; the slider e2e failure is also P1. The three annotate unit failures are base regressions. No files or commits changed because the repair push window is closed.

Session

Pass interrupted; current webhook state retained.

Session

Pass interrupted; current webhook state retained.

Session

Pass interrupted; current webhook state retained.

Session

Pass interrupted; current webhook state retained.

Session

Pass interrupted; current webhook state retained.

Session

Pass interrupted; current webhook state retained.

Session

Pass interrupted; current webhook state retained.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Important

A touch drag can still open the zoom dialog after the drag finishes if the browser delays its compatibility click.

Reviewed changes

  • Slider mode parsing — Adds columns and slider validation, converts slider side notes into numbered notes, and keeps columns mode unchanged.
  • Slider rendering — Adds the two-image overlay, divider semantics, responsive notes, no-script fallback, and a single inlined runtime per rendered document.
  • Slider interaction — Adds pointer dragging with optional coasting, keyboard movement, drag suppression, and integration with the existing zoom runtime.
  • Documentation and coverage — Documents the new mode and adds unit and end-to-end coverage for rendering, dragging, keyboard movement, zoom, and invalid modes.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using gpt-5.6-sol | 𝕏

Comment thread packages/annotate/src/client.ts Resolved
@pkg-pr-new

pkg-pr-new Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

pnpm add https://pkg.pr.new/comark-annotate@17
pnpm add https://pkg.pr.new/comark-carousel@17
pnpm add https://pkg.pr.new/comark-zoom@17

commit: 1015ffc

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ℹ️ No new issues found in the incremental changes; the existing touch-drag click-suppression thread remains open.

Reviewed changes

  • Packaging order — Updated comark-carousel's prepack script to build comark-zoom before the carousel, matching the build-time dependency used by the carousel stylesheet.

The incremental change is mergeable as-is.

Pullfrog  | Fix it ➔ | View workflow run | Using gpt-5.6-sol | 𝕏

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Important

The incremental commit is clean, but the prior touch-drag click-suppression issue remains unresolved and this review therefore cannot approve the PR.

Reviewed changes

  • Fixed carousel packaging order — Updated comark-carousel's prepack script to build comark-zoom before building the carousel, ensuring the workspace dependency is available when packaging.

⚠️ Touch-drag zoom remains possible

A touch drag can still open the zoom dialog if the browser dispatches its compatibility click after the zero-delay timer clears swallow. This is the same outstanding issue from the prior Pullfrog review; the new packaging-only commit does not affect it.

Technical details
# Preserve touch-drag click suppression

## Affected sites
- `packages/annotate/src/client.ts:126` — `swallow` is reset before a potentially delayed compatibility click is consumed.
- `packages/annotate/src/client.ts:134-142` — the capture-phase click listener only suppresses the click while `swallow` remains set.

## Required outcome
- A pointer drag must never trigger the zoom click that follows it, including delayed compatibility clicks on touch input.
- A genuine click without movement must continue to open zoom.

Pullfrog  | Fix it ➔ | View workflow run | Using gpt-5.6-sol | 𝕏

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Important

The new suppression marker fixes the original timer race, but it can still be cleared by a subsequent pointerdown before the delayed compatibility click from the drag is delivered.

Reviewed changes

  • Preserved touch-drag suppression — Replaced the zero-delay boolean reset with a slider-scoped marker that is consumed by the compatibility click.

The remaining edge case is called out inline.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using gpt-5.6-sol | 𝕏

Comment thread packages/annotate/src/client.ts Resolved

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Important

The latest suppression change still leaves a delayed touch compatibility click able to open zoom after a subsequent interaction on the same slider.

Reviewed changes

  • Retained drag-click suppression — Replaced the timer-based reset with a slider-scoped WeakSet marker intended to remain until the compatibility click is consumed.
  • Revalidated the slider surface — Re-read the full PR diff and the incremental suppression change, including the existing pointer, zoom, keyboard, rendering, and test paths.
Technical details
# Keep suppression tied to the drag sequence

## Affected sites
- `packages/annotate/src/client.ts:126` — records suppression only by slider element, not by the pointer sequence that produced the pending compatibility click.
- `packages/annotate/src/client.ts:134-144` — the capture-phase click handler consumes the single element marker for whichever click arrives first.

## Required outcome
- A compatibility click generated by a completed touch drag must remain suppressed until that specific click is consumed, even if another pointer sequence starts first.
- A genuine click from a newer interaction must still open zoom.

## Suggested approach
- Associate the pending suppression with the originating pointer sequence or otherwise distinguish the delayed compatibility click from a later genuine click before consuming the marker.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using gpt-5.6-sol | 𝕏

Comment thread packages/annotate/src/client.ts Resolved

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Important

The latest suppression change still allows a delayed touch compatibility click to reach zoom, so the drag interaction is not safe to merge yet.

Reviewed changes

  • Retained drag suppression state — Changed the pending suppression marker from a boolean set to a per-slider count and added a click-detail check intended to preserve genuine follow-up clicks.
  • Hardened bound URL validation — Resolved bound URL props in isolation so an unsafe bound value is reported even beside a plain value.
  • Adjusted validation coverage — Updated annotate tests and added coverage for the bound URL case.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using gpt-5.6-sol | 𝕏

Comment thread packages/annotate/src/client.ts Resolved

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Important

The latest commit does not make touch-drag suppression reliable, and it exposes combined plugin issues through the annotate-specific metadata field.

Reviewed changes

  • Classified compatibility clicks — Expanded slider click suppression to use sourceCapabilities.firesTouchEvents alongside click.detail.
  • Exposed issue metadata — Added annotateIssues while retaining the shared meta.issues list.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using gpt-5.6-sol | 𝕏

Comment thread packages/annotate/src/client.ts Outdated
const pending = swallow.get(swipe) ?? 0;
// Compatibility clicks identify their touch origin through sourceCapabilities. Keep a
// pending marker for genuine mouse clicks so a delayed touch click cannot open zoom later.
const touchClick = event.detail === 0 || event.sourceCapabilities?.firesTouchEvents === true;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This still does not reliably identify the delayed compatibility click. sourceCapabilities may be absent, while firesTouchEvents describes device capability rather than the originating pointer sequence, so a delayed touch click can bypass this gate and reach zoom; conversely, a genuine device-independent activation can be swallowed while pending is set.

Technical details
# Keep drag suppression tied to the originating interaction

## Affected sites
- `packages/annotate/src/client.ts:143-146` — classifies clicks with `detail` and optional `sourceCapabilities`, then consumes suppression only when the heuristic matches.

## Required outcome
- A compatibility click generated by a completed touch drag must be suppressed even when the browser omits `sourceCapabilities`.
- A genuine click or keyboard/assistive activation after the drag must not be suppressed.
- Suppression needs to remain associated with the completed drag sequence rather than relying only on click provenance heuristics.

## Suggested approach
- Track the pending compatibility click by the originating pointer sequence and use browser-compatible fallback behavior when the click event does not expose source capabilities.

Comment thread packages/annotate/src/index.ts Resolved
@vite-hub

vite-hub Bot commented Oct 20, 2026

Copy link
Copy Markdown
Contributor

Current HEAD 0da7470 was rechecked. Pullfrog’s open findings remain valid P1s: touch-drag compatibility-click suppression still depends on optional sourceCapabilities and can misclassify delayed clicks; meta.annotateIssues is still assigned the combined meta.issues array. Required checks also fail on the existing PointerEvent.sourceCapabilities lint error and four e2e regressions (base 26233e9 passes). The repair push window is closed until 2026-10-21T09:00:17Z, so these cannot be repaired in this pass.

@vite-hub

vite-hub Bot commented Oct 20, 2026

Copy link
Copy Markdown
Contributor

Verified current HEAD 0da7470: Pullfrog touch-drag suppression remains a valid P1 because click handling still relies on optional sourceCapabilities and can misclassify delayed compatibility clicks; annotateIssues also still aliases combined meta.issues (valid P1). Required lint fails on PointerEvent.sourceCapabilities, and e2e has four regressions; exact base 26233e9 passes these checks. Repair push window is closed, so no code changes were made in this pass.

The earlier merge of main kept this branch's annotate files and dropped main's
annotate changes (#12, #21). This takes main as it is and adds the slider on top.
It also drops the annotateIssues alias that main had replaced with meta.issues,
suppresses the click that ends a drag by remembering whether the last press
dragged instead of guessing a touch origin, and gives the zoomed slider's handle
its tab stop back.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Important

No new issues were introduced by this delta, but the existing touch-drag compatibility-click issue remains unresolved, so this PR is not ready for approval.

Reviewed changes

  • Aligned annotate test expectations — Updated packages/annotate/test/annotate.test.ts for the current href rendering, shared meta.issues metadata, carousel accessibility attributes, and hex color output.

The reviewed delta is test-only. The outstanding prior concern is intentionally not duplicated as a new inline finding: packages/annotate/src/client.ts can still lose drag-click suppression when a later non-drag press overwrites the pending state before the earlier touch compatibility click arrives.

Pullfrog  | Fix it ➔ | View workflow run | Using gpt-5.6-sol | 𝕏

@vite-hub

vite-hub Bot commented Oct 20, 2026

Copy link
Copy Markdown
Contributor

Verified current HEAD a61b4cc. Pullfrog touch-drag compatibility-click suppression remains a valid P1: dragged is keyed only by slider and can let a delayed touch click be consumed by a later interaction or reach zoom. The current required checks also still show the known three annotate expectation failures (present on base) and one slider e2e failure. Repair push window is closed until 2026-10-21T09:00:17Z, so no code or commit changes were made this pass.

@vite-hub
vite-hub Bot merged commit e884944 into main Oct 20, 2026
5 of 8 checks passed
@github-actions github-actions Bot mentioned this pull request Oct 20, 2026
vite-hub Bot pushed a commit that referenced this pull request Oct 20, 2026
#14 was squashed from a branch older than #12 and #21, so it put back annotate's earlier read.ts and tests:
an unknown prop named `constructor` or `__proto__` printed Object's own value as its hint, viewports compared as
strings ("0900x0360" no longer matched "900x360"), and two tests expected the old href message. Those parts
are restored; #17's compare mode stays.

The slider e2e test clicked at coordinates measured before focusing the handle, which can scroll the page, so it
missed the slider under load. It measures again before that click.

zoom's client.ts holds its own copy of the zoom script since #14, so its doctor suppression covers it too.
This was referenced Oct 22, 2026
@onmax
onmax deleted the feat/compare-slider branch November 1, 2026 11:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant