Skip to content

History diff ​

Two versions of a record side by side, read-only, with what changed between them marked in red and green.

history-historycomparison--defaultOpen in Storybook ↗

When to use ​

  • Checking what changed on a record, and who changed it: open the history page with View history in the page header.
  • Comparing any two saved versions, including the current one.

When not to use ​

  • Editing or restoring a value: the diff is read-only. Edit the record itself, in its field rows.
  • Unsaved changes in an open form: the history only holds saved versions.

Anatomy ​

  1. Entry point: a secondary, small button View history with a history icon in the page header. It shows when the client turns it on.
  2. Two columns, one per version, each with a header that stays on top while you scroll:
    • a dropdown to pick the version. Each option reads Version {n} ({date}), followed by · {author} when known. Only the left dropdown offers Current version (Version {n});
    • Edited by {author} on {date} under it, in --text-label, --color-text-muted.
  3. The record's panels, read-only, in the same order on both sides, so the same field sits at the same height. The id field and fields configured as hidden in history are left out.
  4. Diff marks on what changed:
    • A changed field value becomes a chip: red on the older version, green on the newer. Unchanged values stay plain text.
    • Relations are chips: added in --color-diff-new on --color-diff-new-bg, removed in --color-diff-old on --color-diff-old-bg, unchanged in the neutral chip colours. Each column shows only its own side: the newer version shows what was added, the older one what was removed.
    • A changed rich-text field gets a --color-diff-new-border border on --color-diff-new-bg on the newer side, and the -old pair on the older side.
history-relationdifflist--statesOpen in Storybook ↗

Red and green follow the dates, not the columns: whichever version is older is red, wherever you put it. By default the current version is on the left and the version before it on the right.

Variants ​

ChangeOlder versionNewer version
Field valuevalue as a red chipvalue as a green chip
Relation added—green chip
Relation removedred chip—
Related record renamedred chip with the old name · renamedgreen chip with the new name · renamed
Rich textred border and tintgreen border and tint
Unchangedplain value, neutral chips, default borderthe same

The chip colours of changed field values come from the client's pill configuration (modified for the older value, added for the newer).

Repeated groups of fields are compared entry by entry, by position: only the fields that differ in an entry are marked.

States ​

StateWhat you seeTrigger
Loadinga spinner under the column headera version is being fetched
Comparedboth columns with diff marksboth versions loaded
No historyThis item has no history yet. in the right columnno saved versions exist for the record
No earlier versionThere are no earlier versions yet. in the right columnthe record has only its current version
Version failedThis version could not be loaded. in that columnfetching one version fails
History failedThe history could not be loaded. Please try again later. above both columnsfetching the version list fails
history-historycomparison--statesOpen in Storybook ↗

Messages sit in a bordered box in body text. When the client hides empty fields, a field that is empty in a version is left out of that column.

Keyboard & accessibility ​

KeyOn a version dropdown
Tabmoves to the dropdown
Enter / Spaceopens it; the dropdown keys apply
  • Everything below the headers is read-only and has no controls of its own.
  • An added or removed relation chip carries hidden text, added or removed, so screen readers don't rely on its colour. A renamed relation shows renamed.
  • A changed field value is a chip where the unchanged value is plain text, so the change shows without colour. Which side is older is told by the dropdown and the Edited by line.
  • The diff text colours are the ink variants of danger and success, which reach 4.5:1 on their tints.

Content ​

  • Version labels count up from the oldest version: Version 1 is the first save.
  • Translation keys: history.view-history, history.current-version, history.current-version-number, history.version-label, history.version-label-undated, history.edited-by, history.added, history.removed, history.renamed, history.no-items, history.no-history, history.no-previous-versions, history.version-load-error, history.versions-load-error.

Field row · Chip & badge · Dropdown · Panel & block shells · Comments

Powered by Elody - Open Source Semantic Data Platform