Lab

Entry editor

Slant / Controls

An “Edit post” form: a title, a slug, the body, a Repeater of links and a scheduled publish, autosaved as you type, with an ErrorSummary when Publish finds a problem.

The theme follows the link: share a page with ?theme=moon.

Usage

  • Each control sits in a <Field>: the title Input, a monospace slug that follows the title until you edit it, a MarkdownEditor for the body (its preview drawn by react-markdown in Prose), a Repeater of up to four links (each URL in a Field of its own), and a RadioGroup of Now or Schedule. Schedule adds a DateTimePicker from now on.
  • Every edit autosaves: SaveStatus reads Unsaved changes, then Saving… 800 ms after the last edit, then Saved with the time. Work offline holds the saves as Offline with a Retry; back online, the held save goes through.
  • Publish checks the title and the body, the slug’s pattern, each link’s URL, and a scheduled time in the future. Failing, an ErrorSummary at the top takes focus (submitCount) with a link to each problem, and each failing Field shows its error. Passing, the status line reads “Published.” or “Scheduled for Tuesday, November 3 at 9:00 AM (Europe/London).”
  • The form is its own scroll area, and its action bar sticks to the bottom edge: the save status and Work offline at the start, Save draft and Publish at the end.

Keyboard

Tabmoves through the summary’s links, the fields, each link’s label, URL and buttons, Add link, the publish choice and the bar
Enterpublishes from a one-line field, or follows the focused summary link to its field
Alt + ↑ / ↓on a link’s move button, moves the link a place; Alt + Home / End moves it to the top or the bottom
← / → / ↑ / ↓chooses Now or Schedule
Alt + ↓opens the calendar from the date input
Spacetoggles Work offline, or presses the focused button

Accessibility

  • The error summary is a group named by its heading, inside an alert, and takes focus after each failed Publish. Each of its links focuses the control to fix: a link row’s URL input, or the schedule’s date input.
  • Each error joins its control’s aria-describedby only while it shows, and the control is aria-invalid; a link’s URL carries its own error, and the summary keeps the list from the last Publish.
  • The save status is not a live region: it speaks politely when a save lands and when saves go offline. Publish’s outcome lands in a status region.
  • Each link row is a group named by its label (“Link 1” until it has one), and its move and remove buttons say whose they are.

Entry editor in React and SwiftUI.

Source

The React tab is the component’s real source; the SwiftUI tab is its twin in TUTTNKit.