Repository navigation
Description
Part of #499.
Read the parent first. This is Step 7 of the tracker. It can run beside #508. Work on main.
Summary
- Today. During a TOC drag, a screen reader hears the wrong words. dnd-kit reads the raw toc-id and says "press the space bar", but the TOC has no keyboard drag (read from code). A move speaks no result (read from code). After a menu move that changes the parent, focus can fall to the page body (secondary / inferred). Ctrl/Cmd+Z does nothing while focus is in the TOC (read from code: no handler; the effect is not measured).
- After. One polite TOC live region speaks one result line per move. dnd-kit speaks nothing. After a menu move, focus lands on the moved row's grip or title link. Ctrl/Cmd+Z in the TOC runs the editor's undo.
- Why. Cascade (R1), capture (R2) and squash (R4) change rows that the person did not drag. Only the result line tells a screen-reader user what changed. A keyboard user who loses focus after a move also loses their place.
#506 builds the result line with describeMoveResult. This issue only speaks it. This issue adds no new visual, token or motion. It needs no design-system ruling.
Maintainer rulings that bind this issue
The full text is on #499.
- R1. Every sub-heading shifts by the same level change
d. The result line says so. - R2. Following deeper headings fall inside the moved heading (capture). The result line names them.
- R3. The Title row has no grip and offers no Move rows. So it is never the moved row. Its title link can be the fallback focus target when the moved row is still hidden.
- R4. A sub-heading that would pass H6 stays at H6 (squash). The result line gives the count.
- R5. A hallway test runs before release. Run the TOC move hallway test before drop inside ships #509 leaves the keyboard-only and screen-reader passes to this issue, in Step 7.
- R6. A set is one heading plus its whole subtree. There is no multi-select, so a result line always speaks about one set.
Depends on / Blocks
- Depends on Show where a moved section landed after a TOC move #506. That issue adds the settle step,
settleMove. It waits for the TOC rebuild, opens the folded path, scrolls, flashes and shows the Undo toast. It also addsdescribeMoveResultinapps/webapp/src/components/toc/utils/describeMoveResult.ts, which builds the result line (its Step 6 phrase table). This issue hooks into the settle step. It adds no second wait and no second unfold. - Depends on Add Move rows to Section options and open the menu from the grip #501. That issue adds the four Move rows: Move section up, Move section down, Promote section and Demote section. It also adds the
ContextMenuopenForhandle and makes the grip a menu button. It also owns every grip rule: no grip on the Title row and no grip on a locked pad. The new instruction "Press Enter for move options" is true only after it ships. - Depends on Move a TOC section with its sub-headings and keep the Title fixed #500 for the refusal names this issue reads:
'locked'and'above-title'. - Needs D23 ruled before Step 5 merges. D23 is on [Tracking] Move TOC sections like folders: cascade, drop inside, and a menu path #499. It covers "Ctrl/Cmd+Z in the TOC runs the editor undo". Its ruling goes on Move a TOC section with its sub-headings and keep the Title fixed #500, which owns the
stopCapturing()calls. D23 is ruled on Move a TOC section with its sub-headings and keep the Title fixed #500 (2026-10-16): yes. Under the [Tracking] Move TOC sections like folders: cascade, drop inside, and a menu path #499 ruling of 2026-10-15, a kept D23 is a deliberate exception toAGENTS.md:151. This issue does not own D23. - Depends on Start a TOC drag from the whole row and cancel it safely #505. That issue cancels a drag with a synthetic
pointercancelwhen the lock turns on, or when a peer deletes the source. It reacheshandleDragCancel. Start a TOC drag from the whole row and cancel it safely #505 records the cause incancelCauseRef('locked'or'source-gone'). This issue reads that ref. ThePointerSensorends a drag onpointercancel(read from code: installed@dnd-kit/[email protected]dist/core.esm.jslines 1440-1441 and 1611, local file). - Merged before this issue starts: Rebuild the TOC drop hit test so folded rows and gaps land right #503. Show where a moved section landed after a TOC move #506 depends on Set the drag level from the row above and indent the drop line #504, which depends on Rebuild the TOC drop hit test so folded rows and gaps land right #503. So Step 3 edits the drag hook as Rebuild the TOC drop hit test so folded rows and gaps land right #503 leaves it. The rest of this bullet is that issue's plan, not code yet (secondary). That issue deletes
handleDragOverandfindDropTarget, and addshitTestDrop. Nothing reads dnd-kit'soverafter it. A release over the header row returns its "no drop" target (noDrop: true). ThenoDropfield comes from Rebuild the TOC drop hit test so folded rows and gaps land right #503 in every case. Its Decision A sets only the cursor. A release over the dragged set (the ghost) returns its empty target. The Title row has no before zone, so no drop resolves above the Title. - Blocks Run the TOC move hallway test before drop inside ships #509. The hallway test runs before release, on the finished move feature. Its Out of scope places the keyboard-only and screen-reader passes here, in Step 7.
Current behaviour
Code links are pinned to 85295b8cf2fc8f78efd5a3eaa4ecc05af413c2b2. Installed library files have no permalink. They are marked "local file", with the version pinned in bun.lock.
DndContextgetssensors,collisionDetection,modifiersand the handlers. It gets noaccessibilityprop (TocDesktop.tsx:100-104; read from code).- The only sensor is a
PointerSensorwith a 5px distance. NoKeyboardSensorexists (useTocDrag.ts:73; read from code). - So dnd-kit uses its default text (read from code: installed
@dnd-kit/[email protected]dist/core.esm.js, local file; pinbun.lock:908-912):- Lines 40-42: the description says "To pick up a draggable item, press the space bar."
- Line 48: pick-up reads
"Picked up draggable item " + active.id, which is the toc-id. - Lines 71-81: drop and cancel lines also read the toc-id. The cancel line says the item "was dropped".
- dnd-kit's own region is
role="status"witharia-live="assertive". Itsannounceskips anullorundefinedvalue (read from code: installed@dnd-kit/[email protected]dist/accessibility.esm.jslines 17-45 and 47-58; local file). So announcements that returnundefinedkeep that region empty. - The grip spreads
sortable.attributes(TocItemBody.tsx:121-133; read from code). They includearia-describedby, which points at the instruction text (installedcore.esm.jslines 3436-3438; local file). Today the grip's name is "Drag to reorder". - The grip renders whenever
sortableexists (TocItemBody.tsx:116-146; read from code). The only hide rules are.is-draggingand the hover rule (_tableOfContents.scss:35-44,:266-289; read from code). No lock check exists undercomponents/toc/(read from code:git grepforselectDocumentEditingLockedfinds nothing). So today a locked pad still shows the grip. - No live region exists under
components/toc/(read from code:git grepforaria-live,role="status"andsr-onlyfinds nothing). A move speaks no result. The house already has an sr-only polite line in Command jump (CommandJump.tsx:206-212; read from code). ContextMenuwraps its panel inFloatingFocusManagerwith the defaultreturnFocus(ContextMenu.tsx:429; read from code). On close, Floating UI focuses the element that had focus before the menu opened, inside a microtask. If that element is gone, it falls back to a hidden span.ContextMenuuses a virtual reference, so that span is never inserted. So no element takes focus (read from code: installed@floating-ui/[email protected]dist/floating-ui.react.mjslines 2053-2091, and the insert check at lines 2057-2059, local file; pinbun.lock:1036).ContextMenusets onlyrefs.setPositionReference(ContextMenu.tsx:351-353,:374-376; read from code).- Both menu openers pass the event target to
onBeforeShow: the right-click path and the Shift+F10 / Menu key path (ContextMenu.tsx:343-347,:366-369; read from code). So the target can be the grip, the fold button, the chat trigger, the title link or row text. - A row that changes parent renders under another
ul.toc__children, so React mounts a new row element (TocItemBody.tsx:176-192,TocItemDesktop.tsx:40-49; read from code). After a menu move that changes the parent, the old focused element is gone. So focus falls to the body (secondary / inferred, not measured). Today no menu row moves a section; Add Move rows to Section options and open the menu from the grip #501 adds them. - dnd-kit's
RestoreFocusacts only when the drag started from a keyboard event (read from code: installedcore.esm.jslines 2689-2745,if (!isKeyboardEvent(previousActivatorEvent)) return; local file). A TOC drag always starts from a pointer. SorestoreFocusnever runs here. Where focus goes after a pointer drop is not measured. handleDragEndreads the drop target fromstateRef. When it has no target, it only resets the state and returns (useTocDrag.ts:176-183; read from code). It looks up the active item only after that return (:185-186). It then dispatches the move, scrolls the editor heading and resets the state. It does not touch focus (:176-214).handleDragCanceltakes no event argument and only resets the state (:216). The hook returnsstate, notstateRef(:218-230).- A release in place can reach the no-target branch (read from code).
handleDragOverclears the drop target whenover.id === active.id(useTocDrag.ts:169-174).pointerYCollisionlists every droppable with a rect, the active row too (pointerCollisionDetection.ts:3-31). Sooveris the active row when the pointer rests on it. - A true no-target release is almost unreachable (read from code).
findDropTargetreturns the nearest non-active row whenever any row has a rect (dnd/utils.ts:103-114). So a release over the header row resolves to "before" the first row, which is the Title. The planner from Move a TOC section with its sub-headings and keep the Title fixed #500 refuses that drop with'above-title'.- Items 13 and 14 are true at
85295b8cf. Rebuild the TOC drop hit test so folded rows and gaps land right #503 replaces both code paths before this issue starts (see Depends on). Step 3 targets the code as that issue leaves it.
- Items 13 and 14 are true at
TocDesktopattachescontextMenuRefonly in the non-empty branch (TocDesktop.tsx:89-99; read from code). The first render hasitems = [], so the ref isnullthen.TocDesktophas noeditorin scope. The drag hook reads it withuseStore.getState().settings.editor.instance(useTocDrag.ts:186).- The heading rebuild is throttled at 100ms, with leading and trailing calls. A fold-snapshot change rebuilds at once (
useToc.ts:110-125; read from code, not measured). So the first rebuild after a move is often immediate. buildTocItemskeeps the Title H1 as a TOC row, and skips headings with emptytextContent(useToc.ts:72-87, the skip at:78; read from code). So a TOC row never has an empty title. The row label for an empty heading isHeading ${item.level}(TocItemBody.tsx:154; read from code).- No undo key handler exists under
components/toc/(read from code:git grep -i undofinds nothing). The editor binds Mod-z on its own view (secondary / inferred from the Tiptap keymap model). So Ctrl/Cmd+Z with focus in the TOC does nothing (inferred, not measured). - The pad undo stack is
Y.UndoManager. StarterKit setsundoRedo: false, and the pad loads Collaboration (TipTap.tsx:108-115,:296-298; read from code). Theundocommand returnsfalseon an empty stack (read from code: installed@tiptap/[email protected]dist/index.jslines 112-117, local file; pinbun.lock:1560). The phone toolbar already callseditor.commands.undo()on that stack (MobilePadTitle.tsx:177; read from code). - Every non-error toast is
role="status"witharia-live="polite"(ToastNotification.tsx:33-37; read from code). Show where a moved section landed after a TOC move #506 shows an Undo toast with the result line when rows are captured or squashed (D15). With no rule, a screen reader could hear that line twice (secondary / inferred). - Helpers that already exist (read from code):
- The editing lock:
selectDocumentEditingLockedand the imperativeisDocumentEditingLocked()(isDocumentEditingLocked.ts:8-17). isModShortcut(event, key): Meta on Apple, Ctrl elsewhere, Shift up and Alt up (platform.ts:72-91).- The row lookup
li.toc__item[data-id="{id}"] > .toc__row(dnd/utils.ts:7-8). - The grip shows on row hover or on
:focus-visibleonly (_tableOfContents.scss:266-289).
- The editing lock:
- A live region must never sit inside
.ProseMirror(TipTap/CLAUDE.md:74). The TOC is outside the editor, so a TOC live region is safe (read from code).
Target behaviour
One region, results only
TocDesktopmounts one sr-only element, the TOC live region:role="status",aria-live="polite",aria-atomic="true". It sits in the rootdiv, outside.ProseMirror. It mounts with the TOC, so it exists before the first message.DndContextgets anaccessibilityprop. All four announcements (onDragStart,onDragOver,onDragEnd,onDragCancel) returnundefined.screenReaderInstructions.draggablereads: "Drag to move this section. Press Enter for move options."restoreFocuskeeps dnd-kit's default. It costs nothing, but it does not cover pointer drags (item 11).- To write, the region is first set to empty. The text is written on the next animation frame. So two equal lines in a row are both read.
- A line never speaks a toc-id. It names headings by title. A row never has an empty title (
useToc.ts:78skips them; item 17). IfdescribeMoveResultnames a captured heading with no text, it reads "Heading {level}", asTocItemBody.tsx:154does.
When each line is spoken
| Event | What the region speaks |
|---|---|
| A move succeeds (drag or menu), with or without the Undo toast | The result line from describeMoveResult, once, at settle. The move toast has no live role (D22, part b). |
| The person presses Esc during a drag | Move cancelled. "{title}" is back in place. |
A release over the header row: no target, and the target has noDrop: true (from #503) |
Move cancelled. "{title}" is back in place. |
A release in place over the dragged set: no target, and noDrop is false |
Nothing |
A release in place that resolves to a gap: same slot, d = 0, the planner returns NoOp |
Nothing |
A drop that resolves above the Title (R3). The planner from #500 rules it: it refuses with 'above-title'. |
Move cancelled. "{title}" is back in place. This is a guard only. No UI path reaches it, because the Title row has no before zone. |
A drag is cancelled because the lock turned on (cause 'locked' from #505) |
Editing is locked. Nothing changed. |
A drag is cancelled because a peer deleted the source (cause 'source-gone') |
Nothing |
| Section options closes with no row chosen | Nothing |
The planner refuses with 'locked' |
Editing is locked. Nothing changed. |
| Any other planner refusal | Nothing. No UI path reaches one after #501, #503 and #505 |
| Ctrl/Cmd+Z in the TOC runs an undo | Undid the last change. (D22, part c) |
No pick-up, target-change or spring-open line is spoken.
Focus
- After a menu move. Focus goes to the same control kind that opened Section options, on the moved row. That kind is "grip" or "link".
- The opener kind is recorded when the menu opens. A target inside
.toc-drag-handlerecords "grip". The fold button, the chat trigger, the title link and row text record "link" (item 9). - After Add Move rows to Section options and open the menu from the grip #501 lands, a locked pad shows no grip. If the lock turns on between menu open and settle, focus goes to the title link. The helper's link fallback is the guard for that case.
- The focus call runs at settle, after the commit that holds the moved row. It runs inside one
requestAnimationFrame. That lands after Floating UI's return-focus microtask (item 8). - It uses
focus({ preventScroll: true }), so the settle scroll in Show where a moved section landed after a TOC move #506 stays the only TOC scroll. - If the moved row is still hidden (no client rects), focus goes to the title link of its nearest visible ancestor row. That can be the Title row's link (R3).
- The opener kind is recorded when the menu opens. A target inside
- On Cancel or Esc in Section options. Focus returns to the opener. Floating UI does this today, because the opener still exists (item 8). So no code is needed. A browser check confirms it.
- After a pointer drop. Change nothing unless Step 0 shows lost focus. If it does, apply one rule. Focus was inside the TOC at pick-up, and it is on the body after settle. Then focus the moved row's grip, or its title link when no grip shows.
- After the TOC undo key. The undo can remount the focused row and drop focus to the body. Then focus goes back to the same control kind on that heading's row. The same helper does this.
TOC undo key
- Ctrl+Z (Cmd+Z on Apple) runs
editor.commands.undo()when focus is anywhere inside theTocDesktoprootdiv. - It does nothing while a drag runs or on a locked pad. It also does nothing when the key target is an
input, atextareaor a contenteditable element. - It calls
preventDefault()only when it runs the undo. - Ctrl/Cmd+Shift+Z and Ctrl+Y are not handled.
isModShortcutalready rejects Shift. - The undo reverts the last stack item. With D23, every move is its own item. If the person typed after the move, the undo reverts the typing first. That is the D23 behaviour, not a bug.
- No primary source was checked for this key in the Google Docs, Word or Notion outline. So the D23 ruling on Move a TOC section with its sub-headings and keep the Title fixed #500 records it as a deliberate exception to
AGENTS.md:151, unless it names a peer source.
Micro-interactions
This issue owns no step of the Drag timeline on #499. It builds the live-region part of steps 9 and 16, plus the focus cue at settle. It adds no animation, so it uses no motion token. Every time below is read from code, not measured.
| Time | What happens | Owner |
|---|---|---|
| t0 | The move dispatches. | #500 |
| t0 to up to 100ms (often 0) | Settle waits for the first items change (item 16). |
#506 |
| Settle commit | The folded path opens and the TOC row scrolls into view. | #506 |
| Settle commit + 1 frame | One requestAnimationFrame runs. Focus moves to the opener control kind (menu moves only). Then announce runs and sets the region to empty. |
This issue |
| Settle commit + 2 frames | The region gets the result line. The Undo toast, if any, shows without a live role. | This issue |
| On drag cancel | announce runs at once and sets the region to empty. The cancel line follows one frame later. There is no settle wait, because no transaction ran. |
This issue |
- The focus ring is the existing grip
:focus-visiblereveal, or the title link's existing focus style. Nothing new is drawn. - Reduced motion changes nothing here. Speech and focus are not motion.
Implementation steps
Read AGENTS.md, apps/webapp/CLAUDE.md and apps/webapp/src/components/TipTap/CLAUDE.md first. Do the steps in this order. Start after #506, #501 and #505 are merged.
Step 0. Measure two facts (gates Step 4b and the grip rule in Step 4)
Run make dev-local. Read the WEBAPP port from the make dev-local output; Next moves to the next free port when 3000 is busy (dev-local-preflight.ts:318). Open http://localhost:<port>/editor?localPersistence=true&docName=toc-a11y-lab. Use a visible tab and real pointer and key input. Post the results on this issue as ## Step 0, <date>.
- In Chrome, Safari and Firefox: press the grip, drag a section into a new parent, and release. Log
document.activeElementafter settle. - Open Section options with a mouse click on the grip, then choose a Move row. After the focus call, check whether the grip matches
:focus-visibleand shows.
Step 1. Add the region and the announcer
- Add
apps/webapp/src/components/toc/hooks/useTocAnnouncer.ts. It returns{ message, announce }.announce(text)sets the message to'', then setstextinside onerequestAnimationFrame. It cancels a pending frame on a new call and on unmount. - In
TocDesktop.tsx:98-176, render<div role="status" aria-live="polite" aria-atomic="true" className="sr-only">{message}</div>inside the rootdiv. - Do not export the hook from
toc/index.ts(apps/webapp/CLAUDE.md§TOC And Heading Actions: shell-facing barrel only).
Step 2. Silence dnd-kit and replace its instruction
- Add one module-level constant, for example
TOC_DND_ACCESSIBILITYin a newapps/webapp/src/components/toc/dnd/accessibility.ts. A module constant keeps one object identity across renders. - It holds the four announcements that return
undefinedand the newscreenReaderInstructions.draggabletext. It leavesrestoreFocusunset. - Pass it as
accessibilitytoDndContextatTocDesktop.tsx:100-104.
Step 3. Speak the result, cancel and locked lines
- Result line. In
settleMovefrom Show where a moved section landed after a TOC move #506, after it opens the path and scrolls, run onerequestAnimationFrame. Inside it, call the Step 4 focus helper first (menu moves only). Then callannounce(describeMoveResult(...))in the same frame, afterfocus(). That puts the text at settle + 2 frames, as the table says. Do this for every successful move, toast or not. - No-target branch of
handleDragEnd(useTocDrag.ts:180-183at85295b8cf; edit it as Rebuild the TOC drop hit test so folded rows and gaps land right #503 leaves it). Do not readevent.over. After Rebuild the TOC drop hit test so folded rows and gaps land right #503, nothing keeps it in step with the drop target.- Read
stateRef.current.dropTargetfirst. WhennoDropis false, this is a release in place over the dragged set, or a release before the first move. Speak nothing. - When
noDropis true (the header row), look upflatItems.find((f) => f.id === String(event.active.id))beforeresetState(). Speak the cancel line with its title.
- Read
handleDragCancel(useTocDrag.ts:216): change it to take itsDragCancelEvent. ReadcancelCauseRef.currentfrom Start a TOC drag from the whole row and cancel it safely #505 first, then clear it. Cause'locked'speaks the locked line. Cause'source-gone'speaks nothing. With no cause, look upflatItems.find((f) => f.id === String(event.active.id))beforeresetState(), and speak the cancel line with its title.- Planner outcomes. When the planner returns NoOp, speak nothing. When it refuses with
'locked', speak the locked line. When it refuses with'above-title', speak the cancel line with the source title; this is a guard that no UI path reaches. Speak nothing for any other refusal. - Pass
announceinto the drag hook and the Move rows as an argument. Do not put it in a store.
Step 3b. Take the live role off the move toast (D22, part b). Add one opt-in option to ToastNotification (ToastNotification.tsx:33-37) that drops the role and aria-live attributes. The default keeps them, so every other toast is unchanged. Set the option on the move toast from #506 only. The Undo button stays a normal button, reachable by Tab.
Step 4. Return focus after a menu move
- In
handleBeforeShow(TocDesktop.tsx:57-72), record the opener kind in a ref beside the heading id.target.closest('.toc-drag-handle')records "grip". Every other target records "link". TheopenForpath from Add Move rows to Section options and open the menu from the grip #501 also runsonBeforeShow, so it records the opener too. - Each Move row passes the opener kind into the settle request from Show where a moved section landed after a TOC move #506.
- Add one helper in
toc/, for examplefocusTocRowControl(id, kind). It finds the row with thegetItemElementselector (dnd/utils.ts:7-8). It picks.toc-drag-handleora.toc__row-link. It falls back to the link when no grip renders. After Add Move rows to Section options and open the menu from the grip #501, that fallback is only a guard for a lock that turns on between menu open and settle. It skips any element with no client rects, and then tries the nearest visible ancestor row's link. It callsfocus({ preventScroll: true }). - At settle, call the helper inside the Step 3
requestAnimationFrame, beforeannounce. - Grip rule from Step 0, fact 2. If a programmatically focused grip stays hidden after a mouse-opened menu, record "link" for every pointer open. Keep "grip" for keyboard opens only.
Step 4b (only if Step 0, fact 1, shows lost focus). At drag start, record whether document.activeElement is inside the TOC. At settle, if it was and focus is now on the body, call the Step 4 helper for the moved row.
Step 5. Add the TOC undo key (merges only after D23 is ruled)
- In
TocDesktop, add a ReactonKeyDownon the rootdivof the non-empty branch (thecontextMenuRefelement atTocDesktop.tsx:99). Do not add a native listener in auseEffect(..., []). The ref isnullon the first render (item 15), so that listener would never attach. If you need a native listener, key the effect onhasItems. ContextMenulistens on the same element for its menu keys (ContextMenu.tsx:366-383). The two keys do not overlap.- Read the drag state from a ref. Have
useTocDragreturn itsstateRef(useTocDrag.ts:67-68, return at:218-230). ReadstateRef.current.activeIdin the handler. - Run only when all of these hold:
isModShortcut(event.nativeEvent, 'z')is true. It takes a nativeKeyboardEvent, so passevent.nativeEventfrom the React handler (platform.ts:80-91).- The target is not an
input, atextareaor a contenteditable element. - No drag runs (
stateRef.current.activeIdisnull). isDocumentEditingLocked()is false.useStore.getState().settings.editor.instanceexists and is not destroyed (as atuseTocDrag.ts:186).
- Then call
preventDefault(). Record the focused row id and control kind fromdocument.activeElement:- id:
activeElement.closest('li.toc__item')?.getAttribute('data-id'). - kind: "grip" when
activeElement.closest('.toc-drag-handle')matches, else "link".
- id:
- Call
editor.commands.undo(), asMobilePadTitle.tsx:177does. - When it returns
true, speak "Undid the last change." (D22, part c). It returnsfalseon an empty stack (item 19). - Keep the recorded id and kind as one pending restore. On the next
itemschange, if focus is on the body, call the Step 4 helper with them. Clear the pending restore after oneitemschange or after two frames, whichever comes first. An undo that changes no heading then cannot fire a late restore.
Step 6. Docs
- Make the edits listed under Docs to update.
Step 7. Expert checks
- Run the TOC move hallway test before drop inside ships #509 leaves these passes to this issue. Run one keyboard-only pass and one screen-reader pass (VoiceOver with Safari, or NVDA with Chrome). Use the Verification script. Post both as
## Expert checks, <date>on this issue.
Stop at a review checkpoint.
Out of scope
- A
KeyboardSensoror arrow-key moves. Atlassian advises against them (primary source: accessibility guidelines, "we recommend not leveraging directional controls (arrow keys)"). - Alt+Shift+arrow shortcuts on TOC rows. The tracker lists them as out of scope.
- A redo key in the TOC. The spec names undo only.
- Pick-up, target-change and spring-open lines (D22 recommends results only).
- The result line text and its builder,
describeMoveResult. Show where a moved section landed after a TOC move #506 owns them. - The grip's name,
aria-haspopup,aria-expanded, thearia-roledescriptionstrip, and the grip rules (no grip on the Title row or on a locked pad). Add Move rows to Section options and open the menu from the grip #501 owns them. - The lock-mid-drag cancel and the cause ref. Start a TOC drag from the whole row and cancel it safely #505 owns them.
- The drop zones, including no drop line above the Title. Rebuild the TOC drop hit test so folded rows and gaps land right #503 owns them.
- The phone TOC (D27). It has no grip and no menu today.
Decisions
Owner: the maintainer. The recommended answer comes first. The ruling is posted as a comment headed Maintainer ruling, <date>.
- D22. One TOC live region for move results? Not a design-system ruling (no visual).
- (a) What the region speaks. Recommended: results only. Silence the four dnd-kit announcements and replace the instruction text. Build each line from the planner result. Reason: today dnd-kit reads raw toc-ids and says "press the space bar", and only the result shows R1 shifts, R2 capture and R4 squash. Alternative: also speak pick-up and target changes.
- (b) Who speaks when the Undo toast shows. Recommended: the move toast drops its live role through an opt-in option. The region speaks every line. Reason: react-hot-toast mounts the toast with its text already inside, and screen readers vary on reading such an insert (secondary / inferred). One region gives exactly one line on every screen reader. Alternative: the toast speaks, and the region writes nothing when a toast shows.
- (c) A line for the TOC undo key. Recommended: speak "Undid the last change." Reason: without it, a screen-reader user gets no feedback. The stack also holds typing, so "Undid the move" could be wrong. Alternative: no line.
- D23 is not owned here. It is ruled on Move a TOC section with its sub-headings and keep the Title fixed #500 (2026-10-16): yes, Ctrl/Cmd+Z in the TOC runs the editor undo. Under the [Tracking] Move TOC sections like folders: cascade, drop inside, and a menu path #499 ruling, the kept key is a deliberate exception to
AGENTS.md:151. Step 5 no longer waits on D23. The 2026-10-24 ruling on [Tracking] Move TOC sections like folders: cascade, drop inside, and a menu path #499 still holds every code child of this set.
Acceptance criteria
- D22 (a), (b) and (c) are ruled before merge. D23 is ruled before Step 5 merges.
- The D23 ruling on Move a TOC section with its sub-headings and keep the Title fixed #500 (2026-10-16) kept the TOC undo key. The [Tracking] Move TOC sections like folders: cascade, drop inside, and a menu path #499 ruling of 2026-10-15 makes that a deliberate exception to
AGENTS.md:151. - Step 0 results are posted on this issue.
- Every toast other than the move toast keeps
role="status"(orrole="alert"for errors). - No screen reader ever speaks a toc-id or "press the space bar" during a TOC drag. Checked with VoiceOver and Safari, or NVDA and Chrome.
- The grip's description reads "Drag to move this section. Press Enter for move options."
- After each move, exactly one result line is spoken, built from the planner result. This holds with and without the Undo toast, on both VoiceOver with Safari and NVDA with Chrome.
- Esc during a drag speaks "Move cancelled. "{title}" is back in place."
- A release over the header row speaks the same cancel line.
- A release in place speaks nothing. This holds when the pointer rests on the dragged set and when the planner returns NoOp.
- Code review: the
'above-title'refusal speaks the cancel line. No UI path reaches it, so no browser check covers it. - Code review: the no-target branch reads
dropTarget.noDrop, notevent.over. - A lock-caused cancel speaks "Editing is locked. Nothing changed.", and a peer-delete cancel speaks nothing.
- The region sits outside
.ProseMirror(DevTools:document.querySelector('.ProseMirror [role="status"]')isnull). - After a Move row chosen by keyboard, focus is on the moved row. It is on the grip when the grip opened the menu, else on the title link. This holds when the move changes the parent and when the target was folded.
- Esc or Cancel in Section options returns focus to the opener.
- After the D23 ruling: Ctrl+Z (Cmd+Z on a Mac) with focus in the TOC reverts the last move. Cmd/Ctrl+Shift+Z does nothing in the TOC.
- After the D23 ruling: Ctrl/Cmd+Z in the TOC does nothing on a locked pad and during a drag.
- Real-pointer and real-key browser checks pass in a visible tab at 1440×900, in light and dark.
cy.dragTocItembypasses dnd-kit and the menu, so it proves nothing here. - The keyboard-only pass and the screen-reader pass are posted on this issue.
-
bun run check:push, webapp Jest and the TOC Cypress spec pass. - The
docs/DEMO.mdandapps/webapp/CHANGELOG.mdlines are in the same change.
Verification
Static checks and Jest (Bun only):
bun run --filter @docs.plus/webapp typecheck
bun run lint
bun run lint:styles
bun run --filter @docs.plus/webapp testE2E. Start make dev-local first, and read the WEBAPP port from its output:
BASE_URL=http://localhost:<port> bash scripts/run-tests.sh --e2e --scope editorNever run next build against the live dev server (AGENTS.md §Test Policy).
Browser and screen-reader script. Use a visible tab (check document.visibilityState === 'visible'), 1440×900, light then dark. Use the playground http://localhost:<port>/editor?localPersistence=true&docName=toc-a11y-lab for steps 1-8, or a real pad from http://localhost:<port>/new.
- Tab to a grip. The screen reader reads the grip name and the new description. It never says "space bar".
- Drag a section with the mouse into a gap that captures rows. The Undo toast shows. Hear the result line once, from the region only. Repeat on the second screen reader.
- Drag a section with no capture. Hear the result line once.
- Start a drag and press Esc. Hear the cancel line. Start a drag, move up over the header row, and release. Hear the cancel line. Pick up a section, move it a little, and release it with the pointer still on its own row. Hear nothing.
- Focus a row, press Shift+F10, and open the Move rows. Add Move rows to Section options and open the menu from the grip #501 defines four: Move section up, Move section down, Promote section and Demote section. Choose Demote section. Focus lands on the same control kind on the moved row. Repeat with Enter on the grip.
- Repeat step 5 on a section whose new parent was folded.
- Steps 7-9 run only after the D23 ruling. Press Ctrl/Cmd+Z with focus still in the TOC. The move reverts, and "Undid the last change." is spoken. Focus stays on that heading's row.
- Repeat step 7 with focus in the editor after typing. The editor undo works as before.
- Use a real pad from
/new; the playground has no owner or Read-only setting. The owner turns Read-only on. A second, non-owner account focuses a TOC row and presses Ctrl/Cmd+Z. Nothing happens.
Tests. This issue adds no test (AGENTS.md §Test Policy).
cy.dragTocItemcallswindow._moveHeadingand skips the drag hook and the menu, so it cannot reach the region or the focus code.- The undo key is one guarded call, not dense branching.
- The menu path can be driven by Cypress with Shift+F10 if a focus regression later ships. The failure mode to name: "Focus falls to the body after a Move row that changes the parent. The focus call ran before the TOC rebuild." Prove that test by sabotage.
Docs to update
docs/DEMO.md§Moving a section (DEMO.md:222-231). Edit the text that Move a TOC section with its sub-headings and keep the Title fixed #500 and Add Move rows to Section options and open the menu from the grip #501 leave there. Add the keyboard path in one short paragraph, for example: "No mouse? Focus a row and press Shift+F10 or the Menu key, or press Enter on the grip. Section options has the Move rows. Ctrl+Z (Cmd+Z on a Mac) in the table of contents undoes the last change."apps/webapp/CHANGELOG.md, one bullet under## [Unreleased](CHANGELOG.md:17), in an### Addedgroup. Add that group if it is missing. For example: "Screen readers hear what a table of contents move did. One line names the result. After a menu move, focus returns to the moved row. Ctrl+Z (Cmd+Z on a Mac) in the table of contents undoes the last change." Add the issue link.apps/webapp/CLAUDE.md§TOC And Heading Actions, the "TOC menus + drag" bullet (CLAUDE.md:311). Add one sentence: the TOC owns one polite result-only live region, dnd-kit announcements stay silent, and Mod-z in the TOC runs the editor's undo.
Read first
AGENTS.md§Test Policy, §Simplified English Mandate, §Workflow And Review Expectations (the peer rule at line 151).apps/webapp/CLAUDE.md§TOC And Heading Actions (the "TOC menus + drag" bullet) and §Motion System (motion v1).apps/webapp/src/components/TipTap/CLAUDE.md§Editor Performance (no live region inside.ProseMirror).CONTEXT.md§Pad outline (Title, Block style).- [Tracking] Move TOC sections like folders: cascade, drop inside, and a menu path #499 Shared rules and its Drag timeline. Show where a moved section landed after a TOC move #506 Step 6 for the phrases.
Generated by Claude Code
Activity
HMarzban commentedon Nov 3, 2026
Status, 2026-11-03. Nothing from this issue is in the 2026-11-03 push (
a9b0c69e8..8e25e83df). The TOC has no move live region and no TOC undo key yet.Left:
HMarzban commentedon Nov 5, 2026
Closed by maintainer ruling 2026-11-05: the current TOC drag is the version we keep. It shipped in dd287cb and f571c08..e9d01ff (see #499). Reopen this if the need comes back.