Skip to content

feat(editor_v2): preview versions beside the history list - #2991

Merged
phrogwrld merged 4 commits into
v2-rewritefrom
editor-v2-version-history
Oct 16, 2026
Merged

phrogwrld merged 4 commits into
v2-rewritefrom
editor-v2-version-history

Conversation

@phrogwrld

@phrogwrld phrogwrld commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Page History opens as one wide dialog. The chosen version's page is on the left, the page's saved versions are on the right, and Restore sits beneath them.

  • Versions: "Current version" comes first, with who saved it and when. Below it, "N earlier versions" lists each version titled by its date, with who saved it and what they did. The chosen row is filled and ticked.
  • Keyboard: the list is a native radio group, so arrow keys move through the versions and the preview follows. Focus starts on the current version.
  • Preview: read-only at the editor's reading width, and it can be scrolled from the keyboard. Links in it no longer leave the editor, because it reuses the page editor's PagePreviewSurface.
  • Restore works as before. The version comes back as unsaved changes that Undo can reverse, and the page keeps its path, category and visibility. Restore is disabled for the current version and while a version loads.
  • Narrow screens: below 576px, only the list shows.

The dialog mounts already open. Base UI only sets data-starting-style when open changes on a root that is already mounted, so the pop-in uses Tailwind's starting: variant (@starting-style) instead.

Screenshot

Taken against a local api_v2 with seed data, after three saves as the auth-bypass user. An earlier version is chosen, so Restore is enabled.

Version history dialog. On the left is a preview of an earlier version of "Apply for a school uniform grant". On the right are the current version and three earlier versions, with the chosen one ticked and Restore this version beneath

Test plan

  • apps/editor_v2: typecheck, lint, format:check, check:boundaries, test (960), and build with VITE_API_ORIGIN set
  • The built CSS contains the @starting-style rules for the pop-in
  • Browser check on a content-API page:
    • the current version is selected and focused
    • arrows and clicks move the preview and enable Restore
    • Restore brings the version back as unsaved changes, and Undo reverses it
    • links in the preview don't navigate
    • Esc and ✕ return focus to History
    • a page with one version says "No earlier versions"
    • below 576px, only the list shows
    • the dialog pops in

History opens as one wide dialog: the chosen version's page on the left,
the page's saved versions on the right, newest first, with the current
version selected and Restore beneath them. Arrow keys move through the
versions and the preview follows, and links in the preview no longer
leave the editor. On narrow screens only the list shows.
@github-actions

github-actions Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

Amplify PR previews

App Status URL
forms ⏭ Not affected —
landing ⏭ Not affected —
chat ⏭ Not affected —
form-builder ⏭ Not affected —
analytics ⏭ Not affected —

Commit: 687040a · Branches auto-delete when this PR closes.

ℹ️ feature-flagging uses a single shared preview slot at a fixed URL (preview.feature-flagging.sandbox.alpha.gov.bb) — GitHub login works, but only one FF preview exists at a time (the most recent FF PR build wins). It reads/writes sandbox flag data.

@IsaiahSama IsaiahSama left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nice rework. The radio-group list with the preview following the selection is a clean fit, and reusing PagePreviewSurface fixes links leaving the editor. Approving; the two inline comments are non-blocking decisions.

Out of scope — follow-ups, not blockers

  • Nothing in src/workspace/ has a component test, so this dialog's behaviour (Restore disabled on Current, "No earlier versions", restore → unsaved changes) has none either. The base didn't have one, so this PR doesn't own the gap, but it adds behaviour that a harness would cover.
  • Nit: labelFocus is now exported from ui/table/table-components.tsx for use outside tables. It might sit better in ui/item.tsx next to sectionLabel.

variant="accent"
size="lg"
className="w-full"
disabled={!canRestore || selected === undefined || !snapshot.data}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Non-blocking question. At base, the newest saved version could be restored like any other. Outside the "newer version saved" notice, that was the only one-step way to throw away unsaved edits and go back to the saved page (loadSaved only appears when stale). With Restore disabled on "Current version", that path is gone. The preview also makes it look possible, because "Current version" shows the saved copy while the editor shows the unsaved draft. One option is to allow Restore on Current when the draft has unsaved changes. Dropping it on purpose is fine too, if that's the intent.

role="region"
aria-label="Version preview"
tabIndex={0}
className="min-w-0 flex-1 overflow-y-auto focus-visible:-outline-offset-5 focus-visible:shadow-[inset_0_0_0_2px_var(--color-ink)] max-sm:hidden"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Non-blocking. Below 576px the preview is hidden but Restore still works, so an author on a narrow screen can restore a version they can't see. That may be fine, since Undo reverses it. Otherwise, consider disabling Restore at that width or noting it in the description.

Preserve the side-by-side history dialog while adopting the renamed page history query and Markdown restore helper. Update the existing browser regression for version selection, preview links, narrow screens, focus return and undoable restoration.
@phrogwrld
phrogwrld merged commit 2c71ebc into v2-rewrite Oct 16, 2026
11 checks passed
@phrogwrld
phrogwrld deleted the editor-v2-version-history branch October 16, 2026 18:21
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.

2 participants