A block editor with a slash menu for headings, lists, to-dos and more.
- Status
- In review
- Owner
- Maya Chen
- Target date
- Jan 14
Problem
Teams write a spec in one place and track the work in another, so the two drift apart within a week.
Goals
- One page holds the why, the plan and the live task list.
- Comments sit on the sentence they're about.
Background is in Research notes.
import { UiSchema } from "@effect/ui"import { Html } from "@effect/ui/html"import * as stylex from "@stylexjs/stylex"import { Schema } from "effect"import { Block, insertDatabase, makeBlock, mentionRef, Range } from "./ui/uicontext/components/kit/Blocks.ts"import { Editor, EditorComment, type MentionOption } from "./ui/uicontext/components/kit/Editor.ts"import { InlineDatabase } from "./ui/uicontext/components/kit/InlineDatabase.ts"import { PageTitle } from "./ui/uicontext/components/kit/PageTitle.ts"import { Item, Value, type Property } from "./ui/uicontext/components/kit/Property.ts"import { Table } from "./ui/uicontext/components/kit/Table.ts"import { sx } from "./ui/uicontext/components/Sx.ts"// A product spec: a title with an icon, a cover and its properties, then blocks with handles, a// database of tasks inside the page, mentions and comments on the text. Hover a block for its// handle, press Escape to choose blocks, and type `/` to insert anything.const styles = stylex.create({ page: { inlineSize: "100%", paddingBlockEnd: 48 }, column: { boxSizing: "border-box", maxInlineSize: 832, marginInline: "auto", paddingInline: { default: 56, "@media (max-width: 640px)": 16 } }, grid: { blockSize: "var(--rows)" },})const fields: ReadonlyArray<Property> = [ { key: "status", label: "Status", kind: "select", options: [{ value: "review", label: "In review", tone: "orange" }, { value: "approved", label: "Approved", tone: "green" }] }, { key: "owner", label: "Owner", kind: "person", options: [{ value: "maya", label: "Maya Chen" }, { value: "ana", label: "Ana Ruiz" }] }, { key: "target", label: "Target date", kind: "date" },]const taskFields: ReadonlyArray<Property> = [ { key: "status", label: "Status", kind: "select", options: [{ value: "todo", label: "Not started", tone: "gray" }, { value: "doing", label: "In progress", tone: "blue" }, { value: "done", label: "Done", tone: "green" }] }, { key: "owner", label: "Owner", kind: "person", options: [{ value: "maya", label: "Maya Chen" }, { value: "ana", label: "Ana Ruiz" }, { value: "theo", label: "Theo Robinson" }] },]const people: ReadonlyArray<MentionOption> = [ { kind: "person", id: "ana", label: "Ana Ruiz", detail: "[email protected]" }, { kind: "person", id: "theo", label: "Theo Robinson", detail: "[email protected]" }, { kind: "page", id: "research", label: "Research notes", icon: "🧪", detail: "Product / Research notes" }, { kind: "page", id: "roadmap", label: "Roadmap 2027", icon: "🧭", detail: "Product / Roadmap 2027" },]const text = (value: string) => ({ text: value })const blocks: ReadonlyArray<Block> = [ makeBlock("intro", "callout", [text("Comments are open until Friday. Hover a block for its handle, or press Esc to choose blocks.")], { color: "yellow" }), makeBlock("h1", "heading1", [text("Problem")]), makeBlock("p1", "paragraph", [text("Teams write a spec in one place and track the work in another, so the two drift apart within a week.")]), makeBlock("h2", "heading1", [text("Goals")]), makeBlock("g1", "bulleted", [text("One page holds the why, the plan and the live task list.")]), makeBlock("g2", "bulleted", [text("Comments sit on the sentence they're about.")]), makeBlock("tasks", "database", [], { embed: { kind: "database", id: "tasks", title: "Launch tasks" } }), makeBlock("q1", "todo", [text("Confirm search rules with "), { text: "Ana Ruiz", mention: mentionRef("person", "ana", "Ana Ruiz") }, text(".")], { checked: false }), makeBlock("q2", "paragraph", [text("Background is in "), { text: "Research notes", mention: mentionRef("page", "research", "Research notes", "#research", "🧪") }, text(".")]),]const tasksSeed: ReadonlyArray<Item> = [ { id: "t1", title: "Block handles", values: { status: "done", owner: "theo" } }, { id: "t2", title: "Comments on text", values: { status: "doing", owner: "ana" } }, { id: "t3", title: "Inline databases", values: { status: "todo", owner: "maya" } },]const Message = UiSchema.TaggedEnum({ EditedTitle: { title: Schema.String }, ChoseIcon: { icon: Schema.NullOr(Schema.String) }, ChoseCover: { cover: Schema.NullOr(Schema.String) }, EditedBody: { blocks: Schema.Array(Block) }, ChoseCommand: { command: Schema.String, block: Schema.String }, CommentedOn: { range: Range }, OpenedComment: { comment: Schema.String }, PickedView: { view: Schema.String }, AddedTask: {}, EditedTask: { item: Schema.String, key: Schema.String, value: Value },})export const SpecPage = Html.component({ name: "SpecPage", model: Schema.Struct({ title: Schema.String, icon: Schema.NullOr(Schema.String), cover: Schema.NullOr(Schema.String), blocks: Schema.Array(Block), comments: Schema.Array(EditorComment), active: Schema.NullOr(Schema.String), view: Schema.String, tasks: Schema.Array(Item), }), message: Message,}).make({ init: () => ({ title: "Shared docs spec", icon: "📝", cover: "gradient:dusk", blocks, comments: [{ id: "c1", range: { anchor: { block: "p1", offset: 74 }, focus: { block: "p1", offset: 99 } }, count: 2 }], active: null, view: "all", tasks: tasksSeed, }), update: { EditedTitle: ($, { title }) => $.evolve({ title }), ChoseIcon: ($, { icon }) => $.evolve({ icon }), ChoseCover: ($, { cover }) => $.evolve({ cover }), EditedBody: ($, { blocks }) => $.evolve({ blocks }), // "/database" puts a database where the `/` was; the app makes the collection ChoseCommand: ($, { command, block }) => command === "database" ? $.evolve({ blocks: (b) => insertDatabase(b, block, { kind: "database", id: "tasks", title: "Launch tasks" }).blocks }) : $.model, CommentedOn: ($, { range }) => { const id = `c${$.model.comments.length + 1}` return $.evolve({ comments: (c) => [...c, { id, range, count: 1 }], active: id }) }, OpenedComment: ($, { comment }) => $.evolve({ active: $.model.active === comment ? null : comment }), PickedView: ($, { view }) => $.evolve({ view }), AddedTask: ($) => $.evolve({ tasks: (t) => [...t, { id: `t${t.length + 1}`, title: "New task", values: { status: "todo" } }] }), EditedTask: ($, { item, key, value }) => $.evolve({ tasks: (t) => t.map((i) => (i.id !== item ? i : key === "title" ? { ...i, title: String(value) } : { ...i, values: { ...i.values, [key]: value } })), }), }, view: (h, model) => { const tasks = model.view === "mine" ? model.tasks.filter((t) => t.values["owner"] === "maya") : model.tasks return h.article.attrs(sx(styles.page)).children( PageTitle(h, { props: { id: "spec", title: model.title, icon: model.icon, cover: model.cover, body: "spec-body", record: { fields, item: { id: "spec", title: model.title, values: { status: "review", owner: "maya", target: "2027-01-14" } } }, }, onEmit: { RequestedTitle: ({ title }) => Message.EditedTitle({ title }), RequestedIcon: ({ icon }) => Message.ChoseIcon({ icon }), RequestedCover: ({ cover }) => Message.ChoseCover({ cover }), }, }), h.div.attrs(sx(styles.column)).children( Editor(h, { props: { id: "spec-body", pageTitle: "spec", label: "Spec", blocks: model.blocks, mentions: true, mentionOptions: people, commands: [{ id: "database", label: "Database", description: "Records inside the page.", group: "Databases", glyph: "▦" }], actions: [{ id: "comment", label: "Comment" }], comments: model.comments, activeComment: model.active, blockLink: "https://example.com/spec", }, onEmit: { Changed: ({ blocks }) => Message.EditedBody({ blocks }), ChoseCommand: ({ command, block }) => Message.ChoseCommand({ command, block }), QueriedMention: () => undefined, RequestedAction: ({ action, range }) => (action === "comment" ? Message.CommentedOn({ range }) : undefined), OpenedLink: () => undefined, OpenedMention: () => undefined, OpenedComment: ({ comment }) => Message.OpenedComment({ comment }), Blurred: () => undefined, RequestedUpload: () => undefined, }, slots: { databases: model.blocks .filter((b) => b.type === "database") .map((b) => InlineDatabase(h, { key: b.id, props: { block: b.id, title: "Launch tasks", views: [{ id: "all", label: "All tasks", layout: "table" }, { id: "mine", label: "My tasks", layout: "list" }], view: model.view, count: tasks.length, create: "New task", }, onEmit: { RequestedView: ({ view }) => Message.PickedView({ view }), RequestedTitle: () => undefined, RequestedOpen: () => undefined, RequestedCreate: () => Message.AddedTask(), }, slots: { view: h.div .attrs(sx(styles.grid)) .style({ "--rows": `${(tasks.length + 1) * 37 + 46}px` }) .children( Table(h, { key: `${b.id}:${model.view}`, props: { label: "Launch tasks", records: tasks, fields: taskFields, title: { label: "Task", width: 260 }, selectable: false, rowHeight: 37 }, onEmit: { RequestedEdit: ({ item, key, value }) => Message.EditedTask({ item, key, value }), RequestedOpen: () => undefined, RequestedCreate: () => Message.AddedTask(), RequestedAction: () => undefined, RequestedAddColumn: () => undefined, RequestedCellAction: () => undefined, RequestedColumnAction: () => undefined, RequestedView: () => undefined, RequestedReorder: () => undefined, Selected: () => undefined, }, }), ), }, }), ), }, }), ), ) },})Installation
pnpm dlx shadcn@latest add checkfu/uicontext/editorUsage
import { Block } from "./ui/uicontext/components/kit/Blocks.ts"import { Editor } from "./ui/uicontext/components/kit/Editor.ts"const Message = UiSchema.TaggedEnum({ EditedBody: { blocks: Schema.Array(Block) } })// the app holds the blocks; every edit comes back as the whole next documentexport const PageBody = (h: Html.H<typeof Message.Type>, blocks: ReadonlyArray<Block>) => Editor(h, { props: { id: "page-body", label: "Page content", blocks, placeholder: "Type / for blocks" }, onEmit: { Changed: ({ blocks }) => Message.EditedBody({ blocks }), ChoseCommand: () => undefined, QueriedMention: () => undefined, RequestedAction: () => undefined, OpenedLink: () => undefined, OpenedMention: () => undefined, OpenedComment: () => undefined, Blurred: () => undefined, RequestedUpload: () => undefined, }, })Examples
Compact
A description field inside a record: smaller type, no handles, and a short list of block types.
Exports over 10,000 rows time out after 30 seconds.
import { UiSchema } from "@effect/ui"import { Html } from "@effect/ui/html"import * as stylex from "@stylexjs/stylex"import { Schema } from "effect"import { Block, makeBlock } from "./ui/uicontext/components/kit/Blocks.ts"import { Editor } from "./ui/uicontext/components/kit/Editor.ts"import { sx } from "./ui/uicontext/components/Sx.ts"import { color, font, space } from "./ui/uicontext/components/tokens.stylex.ts"// An issue's description: smaller type, no block handles, and only the blocks a description needs.const styles = stylex.create({ field: { display: "grid", gap: space.xs, inlineSize: "min(560px, 100%)" }, label: { color: color.muted, fontSize: font.sm, fontWeight: 500 },})const Message = UiSchema.TaggedEnum({ EditedDescription: { blocks: Schema.Array(Block) } })export const IssueDescription = Html.component({ name: "IssueDescription", model: Schema.Struct({ blocks: Schema.Array(Block) }), message: Message,}).make({ init: () => ({ blocks: [ makeBlock("d1", "paragraph", [{ text: "Exports over 10,000 rows time out after 30 seconds." }]), makeBlock("d2", "todo", [{ text: "Stream the file instead of building it in memory" }], { checked: false }), makeBlock("d3", "todo", [{ text: "Email a link when the export is ready" }], { checked: false }), ], }), update: { EditedDescription: ($, { blocks }) => $.evolve({ blocks }) }, view: (h, { blocks }) => h.div.attrs(sx(styles.field)).children( h.span.attrs(sx(styles.label)).children("Description"), Editor(h, { props: { id: "issue-description", label: "Description", blocks, compact: true, emptyPlaceholder: "Add a description…", blockTypes: ["paragraph", "bulleted", "numbered", "todo", "quote", "code"], }, onEmit: { Changed: ({ blocks }) => Message.EditedDescription({ blocks }), ChoseCommand: () => undefined, QueriedMention: () => undefined, RequestedAction: () => undefined, OpenedLink: () => undefined, OpenedMention: () => undefined, OpenedComment: () => undefined, Blurred: () => undefined, RequestedUpload: () => undefined, }, }), ),})Images and code
Paste or drop a picture and the app uploads it through RequestedUpload; captions sit under pictures, and code blocks pick a language.
Weekly signups
Signups grew every week after the new onboarding shipped.
select week, count(*) from signups group by weekimport { Command, UiSchema } from "@effect/ui"import { Html } from "@effect/ui/html"import * as stylex from "@stylexjs/stylex"import { Effect, Schema } from "effect"import { Block, makeBlock } from "./ui/uicontext/components/kit/Blocks.ts"import { Editor } from "./ui/uicontext/components/kit/Editor.ts"import { sx } from "./ui/uicontext/components/Sx.ts"// Paste a screenshot, drop a picture, or type `/image`. The block shows the picture at once from a// local preview; the app stores the file and sends the block back with its address. Type under the// picture for its caption. A code block's language is in its corner.const styles = stylex.create({ frame: { inlineSize: "min(680px, 100%)" } })const text = (value: string) => ({ text: value })const chart = "data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 640 280'><rect width='640' height='280' fill='%23f4f4f5'/><g fill='%236366f1'><rect x='60' y='170' width='60' height='80' rx='6'/><rect x='160' y='130' width='60' height='120' rx='6'/><rect x='260' y='110' width='60' height='140' rx='6'/><rect x='360' y='70' width='60' height='180' rx='6'/><rect x='460' y='40' width='60' height='210' rx='6'/></g></svg>"const Message = UiSchema.TaggedEnum({ EditedNotes: { blocks: Schema.Array(Block) }, RequestedUpload: { block: Schema.String, preview: Schema.String }, SucceededUpload: { block: Schema.String, src: Schema.String },})// stands in for the app's upload: it would fetch the file from `preview` and store itconst Upload = Command.make("Example.Upload", { args: { block: Schema.String, preview: Schema.String } }, ({ block, preview }) => Effect.sleep("1200 millis").pipe(Effect.as(Message.SucceededUpload({ block, src: preview }))),)export const ReleaseNotes = Html.component({ name: "ReleaseNotesEditor", model: Schema.Struct({ blocks: Schema.Array(Block) }), message: Message,}).make({ init: () => ({ blocks: [ makeBlock("i1", "heading2", [text("Weekly signups")]), makeBlock("i2", "paragraph", [text("Signups grew every week after the new onboarding shipped.")]), makeBlock("i3", "image", [text("Signups per week, March")], { image: { src: chart, alt: "Bar chart rising each week", width: 640, height: 280 } }), makeBlock("i4", "code", [text("select week, count(*) from signups group by week")], { language: "sql" }), makeBlock("i5", "paragraph", []), ], }), update: { EditedNotes: ($, { blocks }) => $.evolve({ blocks }), RequestedUpload: ($, { block, preview }) => $.run(Upload.make({ block, preview })), // the stored picture replaces the preview; `uploading` comes off SucceededUpload: ($, { block, src }) => $.evolve({ blocks: (blocks) => blocks.map((b) => (b.id === block && b.image !== undefined ? { ...b, image: { src } } : b)) }), }, view: (h, { blocks }) => h.div.attrs(sx(styles.frame)).children( Editor(h, { props: { id: "release-notes", agentId: "editor:release-notes", label: "Release notes", blocks }, onEmit: { Changed: ({ blocks }) => Message.EditedNotes({ blocks }), RequestedUpload: ({ block, preview }) => Message.RequestedUpload({ block, preview }), ChoseCommand: () => undefined, QueriedMention: () => undefined, RequestedAction: () => undefined, OpenedLink: () => undefined, OpenedMention: () => undefined, OpenedComment: () => undefined, Blurred: () => undefined, }, }), ),})Read-only
With readOnly, a page shows its blocks without editing, for a locked page or a viewer.
On-call handbook
The person on call answers pages within 15 minutes, day or night.
- Acknowledge the page.
- Post in the incident channel what you see.
- Hand over at 9:00 with a written summary.
Who to call when the database is down
Page the platform lead, then post the status in the incident channel.
import { Html } from "@effect/ui/html"import * as stylex from "@stylexjs/stylex"import { Schema } from "effect"import { makeBlock } from "./ui/uicontext/components/kit/Blocks.ts"import { Editor } from "./ui/uicontext/components/kit/Editor.ts"import { sx } from "./ui/uicontext/components/Sx.ts"// A locked page: the same blocks, shown as plain elements that can be read and selected, not edited.const styles = stylex.create({ frame: { inlineSize: "min(640px, 100%)" } })const text = (value: string) => ({ text: value })const blocks = [ makeBlock("r1", "heading2", [text("On-call handbook")]), makeBlock("r2", "paragraph", [text("The person on call answers pages within 15 minutes, day or night.")]), makeBlock("r3", "numbered", [text("Acknowledge the page.")]), makeBlock("r4", "numbered", [text("Post in the incident channel what you see.")]), makeBlock("r5", "numbered", [text("Hand over at 9:00 with a written summary.")]), makeBlock("r7", "toggle", [text("Who to call when the database is down")], { collapsed: true }), makeBlock("r8", "paragraph", [text("Page the platform lead, then post the status in the incident channel.")], { indent: 1 }), makeBlock("r6", "callout", [text("Locked by Priya Nair. Ask an owner to change it.")], { color: "gray" }),]export const LockedPage = Html.component({ name: "LockedPage", model: Schema.Struct({}), message: Schema.Never,}).make({ init: () => ({}), update: ($) => $.model, view: (h) => h.div.attrs(sx(styles.frame)).children( Editor(h, { props: { id: "handbook", label: "On-call handbook", blocks, readOnly: true }, onEmit: { Changed: () => undefined, ChoseCommand: () => undefined, QueriedMention: () => undefined, RequestedAction: () => undefined, OpenedLink: () => undefined, OpenedMention: () => undefined, OpenedComment: () => undefined, Blurred: () => undefined, RequestedUpload: () => undefined, }, }), ),})API reference
Props
| Name | Type | Default | Description |
|---|---|---|---|
agentId | string | editor:<id> | This editor's id for agents, unique on the page; editor:<id> by default |
idrequired | string | — | Unique on the page |
labelrequired | string | — | The accessible name: "Page content", "Description" |
blocksrequired | Block[] | — | The document's blocks, in order; edits come back as events |
sync | EditorSync | — | Opt in from the first mount when persisting native changes asynchronously. |
readOnly | boolean | — | Shown as plain elements, with no editing (below Can edit, a locked page) |
compact | boolean | — | Smaller type, for comments and descriptions in a dense app |
placeholder | string | — | On the empty line with the caret |
emptyPlaceholder | string | — | When the whole document is empty |
blockTypes | BlockType[] | — | The block types the menu offers (default: every type but embed) |
commands | SlashCommand[] | — | The app's own / commands, sent as ChoseCommand |
mentions | boolean | — | @ opens the mention menu |
mentionOptions | MentionOption[] | — | For @ and [[: people, agents and pages (a page option's detail is its path) |
mentionsLoading | boolean | — | Shows a loading row in the mention menu while results for the query arrive |
actions | ToolbarAction[] | — | The app's buttons on the selection toolbar, sent as RequestedAction |
held | Range | null | — | A range the app holds highlighted, such as the text an AI is rewriting |
aside | boolean | — | Shows the aside slot under the held range (or the selection): an AI prompt, a comment box |
handles | boolean | — | Block handles, the block menu and block selection; on unless compact |
blockLink | string | — | The page's address: "Copy link to block" copies it with # and the block's id |
comments | EditorComment[] | — | Discussions on ranges of the text: highlighted, with a bubble each in the margin |
activeComment | string | null | — | The discussion that is open now: its highlight is stronger |
recent | string[] | — | Block menu keys picked lately (newest first), shown as "Recent" in the / menu |
pageTitle | string | — | The id of the PageTitle above this body: ArrowUp on the first line goes back into the title |
Events
| Event | Payload | Description |
|---|---|---|
Changed | { id: string; blocks: Block[]; change?: EditorChangeToken } | Keep blocks immediately. Native edits include an acknowledgement token in revisioned mode. |
ChoseCommand | { id: string; command: string; block: string } | One of the app's / commands; the /query is already gone from the line |
QueriedMention | { id: string; query: string } | The person typed after @: answer with mentionOptions |
RequestedAction | { id: string; action: string; range: Range; text: string; markdown: string } | A toolbar action on the selection |
OpenedLink | { id: string; href: string } | Mod+click on a link, or a click on a card |
OpenedMention | { id: string; mention: MentionRef } | A click on a mention of a person, agent or page: open it |
Blurred | { id: string } | Focus left the editor and its parts: a good time to save |
OpenedComment | { id: string; comment: string } | A comment's highlight or bubble was clicked: show its thread |
RequestedUpload | { id: string; block: string; name: string; size: number; type: string; preview: string } | A picture was pasted, dropped or chosen. Its block shows the local preview while uploading; store the file (fetch it from preview), then send the block back with its address and without uploading. A refused upload: remove the block, or keep it with a caption saying why. |
Slots
aside, databases
Wiring it to your app
Keep the blocks in your app, and pass them straight back on each Changed event. The editor handles typing, selection and composition itself.
If saves can finish out of order, set sync.revision on the first mount and echo each change token as sync.acknowledged. Apply a saved result only while its revision, session and sequence still match. To restore a saved version, advance the revision and clear the acknowledgement.
View a complete app example
import { UiSchema } from "@effect/ui"import { Html } from "@effect/ui/html"import { Schema } from "effect"import { Button } from "./ui/uicontext/components/Button.ts"import { Block, paragraph, plainText } from "./ui/uicontext/components/kit/Blocks.ts"import { Editor, EditorChangeToken } from "./ui/uicontext/components/kit/Editor.ts"const Save = Schema.Struct({ blocks: Schema.Array(Block), change: EditorChangeToken })const Message = UiSchema.TaggedEnum({ Edited: { blocks: Schema.Array(Block), change: Schema.optional(EditorChangeToken) }, Restored: {}, DeliveredSave: {},})const sameEdit = (a: typeof EditorChangeToken.Type | null, b: typeof EditorChangeToken.Type) => a?.revision === b.revision && a.session === b.session && a.sequence === b.sequenceexport const Notes = Html.component({ name: "ControlledNotes", model: Schema.Struct({ blocks: Schema.Array(Block), revision: Schema.Int, acknowledged: Schema.NullOr(EditorChangeToken), pending: Schema.NullOr(Save), status: Schema.String, }), message: Message,}).make({ init: () => ({ blocks: [paragraph("note", "Starting note")], revision: 0, acknowledged: null, pending: null, status: "", }), update: { Edited: ($, { blocks, change }) => { if (change === undefined) { return $.evolve({ blocks, revision: (revision) => revision + 1, acknowledged: null, pending: null, }) } if (change.revision !== $.model.revision) return $.model return $.evolve({ blocks, acknowledged: change, pending: { blocks, change }, status: "Draft ready to save." }) }, Restored: ($) => $.evolve({ blocks: [paragraph("note", "Restored note")], revision: (revision) => revision + 1, acknowledged: null, status: "Revision restored.", }), DeliveredSave: ($) => { const { pending, acknowledged } = $.model if (pending === null) return $.model return sameEdit(acknowledged, pending.change) ? $.evolve({ blocks: pending.blocks, pending: null, status: "Draft saved." }) : $.evolve({ pending: null, status: "Earlier save ignored." }) }, }, view: (h, { blocks, revision, acknowledged, pending, status }) => h.section.attrs({ "aria-labelledby": "notes-heading", class: "contract-notes" }).children( h.h2.attr("id", "notes-heading").children("Editable notes"), Editor(h, { key: "notes", props: { id: "notes", label: "Notes", blocks, sync: { revision, acknowledged: acknowledged ?? undefined }, }, onEmit: { Changed: ({ blocks, change }) => Message.Edited({ blocks, change }), ChoseCommand: () => undefined, QueriedMention: () => undefined, RequestedAction: () => undefined, OpenedLink: () => undefined, OpenedMention: () => undefined, OpenedComment: () => undefined, RequestedUpload: () => undefined, Blurred: () => undefined, }, }), h.div.attr("class", "contract-actions").children( Button(h, { emphasis: "outline" }).on("click", Message.Restored()).children("Restore revision"), Button(h, { emphasis: "outline" }).disabled(pending === null) .on("click", Message.DeliveredSave()).children("Deliver save response"), ), h.output.attr("aria-label", "App-owned note").children(blocks.map((block) => plainText(block.content)).join("\n")), h.p.attr("role", "status").children(status), ),})notes.ts on GitHubAccessibility
- The page is one
textboxwitharia-multiline; the/and@menus keep focus in the text and mark the active option witharia-activedescendant. - Escape chooses the blocks the caret is in: Up and Down move, Shift extends, Alt+Shift+Up and Down move them, Mod+D duplicates, Backspace deletes and Enter goes back to the text.
- Mod+/ opens the block menu, and Escape then Tab reaches the add button and the handle, so every pointer action has a keyboard path.
- Each comment bubble names how many comments it holds and the text they're about.