Skip to content

Announce TOC move results and return focus after a move #507

Closed as not planned

Description

@HMarzban

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

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.

  1. DndContext gets sensors, collisionDetection, modifiers and the handlers. It gets no accessibility prop (TocDesktop.tsx:100-104; read from code).
  2. The only sensor is a PointerSensor with a 5px distance. No KeyboardSensor exists (useTocDrag.ts:73; read from code).
  3. So dnd-kit uses its default text (read from code: installed @dnd-kit/[email protected] dist/core.esm.js, local file; pin bun.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".
  4. dnd-kit's own region is role="status" with aria-live="assertive". Its announce skips a null or undefined value (read from code: installed @dnd-kit/[email protected] dist/accessibility.esm.js lines 17-45 and 47-58; local file). So announcements that return undefined keep that region empty.
  5. The grip spreads sortable.attributes (TocItemBody.tsx:121-133; read from code). They include aria-describedby, which points at the instruction text (installed core.esm.js lines 3436-3438; local file). Today the grip's name is "Drag to reorder".
  6. The grip renders whenever sortable exists (TocItemBody.tsx:116-146; read from code). The only hide rules are .is-dragging and the hover rule (_tableOfContents.scss:35-44, :266-289; read from code). No lock check exists under components/toc/ (read from code: git grep for selectDocumentEditingLocked finds nothing). So today a locked pad still shows the grip.
  7. No live region exists under components/toc/ (read from code: git grep for aria-live, role="status" and sr-only finds 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).
  8. ContextMenu wraps its panel in FloatingFocusManager with the default returnFocus (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. ContextMenu uses 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.mjs lines 2053-2091, and the insert check at lines 2057-2059, local file; pin bun.lock:1036). ContextMenu sets only refs.setPositionReference (ContextMenu.tsx:351-353, :374-376; read from code).
  9. 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.
  10. 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.
  11. dnd-kit's RestoreFocus acts only when the drag started from a keyboard event (read from code: installed core.esm.js lines 2689-2745, if (!isKeyboardEvent(previousActivatorEvent)) return; local file). A TOC drag always starts from a pointer. So restoreFocus never runs here. Where focus goes after a pointer drop is not measured.
  12. handleDragEnd reads the drop target from stateRef. 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). handleDragCancel takes no event argument and only resets the state (:216). The hook returns state, not stateRef (:218-230).
  13. A release in place can reach the no-target branch (read from code). handleDragOver clears the drop target when over.id === active.id (useTocDrag.ts:169-174). pointerYCollision lists every droppable with a rect, the active row too (pointerCollisionDetection.ts:3-31). So over is the active row when the pointer rests on it.
  14. A true no-target release is almost unreachable (read from code). findDropTarget returns 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'.
  15. TocDesktop attaches contextMenuRef only in the non-empty branch (TocDesktop.tsx:89-99; read from code). The first render has items = [], so the ref is null then. TocDesktop has no editor in scope. The drag hook reads it with useStore.getState().settings.editor.instance (useTocDrag.ts:186).
  16. 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.
  17. buildTocItems keeps the Title H1 as a TOC row, and skips headings with empty textContent (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 is Heading ${item.level} (TocItemBody.tsx:154; read from code).
  18. No undo key handler exists under components/toc/ (read from code: git grep -i undo finds 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).
  19. The pad undo stack is Y.UndoManager. StarterKit sets undoRedo: false, and the pad loads Collaboration (TipTap.tsx:108-115, :296-298; read from code). The undo command returns false on an empty stack (read from code: installed @tiptap/[email protected] dist/index.js lines 112-117, local file; pin bun.lock:1560). The phone toolbar already calls editor.commands.undo() on that stack (MobilePadTitle.tsx:177; read from code).
  20. Every non-error toast is role="status" with aria-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).
  21. Helpers that already exist (read from code):
  22. 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

  • TocDesktop mounts one sr-only element, the TOC live region: role="status", aria-live="polite", aria-atomic="true". It sits in the root div, outside .ProseMirror. It mounts with the TOC, so it exists before the first message.
  • DndContext gets an accessibility prop. All four announcements (onDragStart, onDragOver, onDragEnd, onDragCancel) return undefined. screenReaderInstructions.draggable reads: "Drag to move this section. Press Enter for move options."
  • restoreFocus keeps 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:78 skips them; item 17). If describeMoveResult names a captured heading with no text, it reads "Heading {level}", as TocItemBody.tsx:154 does.

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-handle records "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).
  • 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 the TocDesktop root div.
  • It does nothing while a drag runs or on a locked pad. It also does nothing when the key target is an input, a textarea or a contenteditable element.
  • It calls preventDefault() only when it runs the undo.
  • Ctrl/Cmd+Shift+Z and Ctrl+Y are not handled. isModShortcut already 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-visible reveal, 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>.

  1. In Chrome, Safari and Firefox: press the grip, drag a section into a new parent, and release. Log document.activeElement after settle.
  2. 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-visible and 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 sets text inside one requestAnimationFrame. 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 root div.
  • 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_ACCESSIBILITY in a new apps/webapp/src/components/toc/dnd/accessibility.ts. A module constant keeps one object identity across renders.
  • It holds the four announcements that return undefined and the new screenReaderInstructions.draggable text. It leaves restoreFocus unset.
  • Pass it as accessibility to DndContext at TocDesktop.tsx:100-104.

Step 3. Speak the result, cancel and locked lines

  • Result line. In settleMove from Show where a moved section landed after a TOC move #506, after it opens the path and scrolls, run one requestAnimationFrame. Inside it, call the Step 4 focus helper first (menu moves only). Then call announce(describeMoveResult(...)) in the same frame, after focus(). 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-183 at 85295b8cf; edit it as Rebuild the TOC drop hit test so folded rows and gaps land right #503 leaves it). Do not read event.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.dropTarget first. When noDrop is false, this is a release in place over the dragged set, or a release before the first move. Speak nothing.
    • When noDrop is true (the header row), look up flatItems.find((f) => f.id === String(event.active.id)) before resetState(). Speak the cancel line with its title.
  • handleDragCancel (useTocDrag.ts:216): change it to take its DragCancelEvent. Read cancelCauseRef.current from 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 up flatItems.find((f) => f.id === String(event.active.id)) before resetState(), 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 announce into 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". The openFor path from Add Move rows to Section options and open the menu from the grip #501 also runs onBeforeShow, 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 example focusTocRowControl(id, kind). It finds the row with the getItemElement selector (dnd/utils.ts:7-8). It picks .toc-drag-handle or a.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 calls focus({ preventScroll: true }).
  • At settle, call the helper inside the Step 3 requestAnimationFrame, before announce.
  • 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 React onKeyDown on the root div of the non-empty branch (the contextMenuRef element at TocDesktop.tsx:99). Do not add a native listener in a useEffect(..., []). The ref is null on the first render (item 15), so that listener would never attach. If you need a native listener, key the effect on hasItems.
  • ContextMenu listens 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 useTocDrag return its stateRef (useTocDrag.ts:67-68, return at :218-230). Read stateRef.current.activeId in the handler.
  • Run only when all of these hold:
    • isModShortcut(event.nativeEvent, 'z') is true. It takes a native KeyboardEvent, so pass event.nativeEvent from the React handler (platform.ts:80-91).
    • The target is not an input, a textarea or a contenteditable element.
    • No drag runs (stateRef.current.activeId is null).
    • isDocumentEditingLocked() is false.
    • useStore.getState().settings.editor.instance exists and is not destroyed (as at useTocDrag.ts:186).
  • Then call preventDefault(). Record the focused row id and control kind from document.activeElement:
    • id: activeElement.closest('li.toc__item')?.getAttribute('data-id').
    • kind: "grip" when activeElement.closest('.toc-drag-handle') matches, else "link".
  • Call editor.commands.undo(), as MobilePadTitle.tsx:177 does.
  • When it returns true, speak "Undid the last change." (D22, part c). It returns false on an empty stack (item 19).
  • Keep the recorded id and kind as one pending restore. On the next items change, if focus is on the body, call the Step 4 helper with them. Clear the pending restore after one items change 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

Stop at a review checkpoint.

Out of scope

Decisions

Owner: the maintainer. The recommended answer comes first. The ruling is posted as a comment headed Maintainer ruling, <date>.

  1. 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.
  2. 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" (or role="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, not event.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"]') is null).
  • 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.dragTocItem bypasses 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.md and apps/webapp/CHANGELOG.md lines 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 test

E2E. 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 editor

Never 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.

  1. Tab to a grip. The screen reader reads the grip name and the new description. It never says "space bar".
  2. 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.
  3. Drag a section with no capture. Hear the result line once.
  4. 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.
  5. 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.
  6. Repeat step 5 on a section whose new parent was folded.
  7. 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.
  8. Repeat step 7 with focus in the editor after typing. The editor undo works as before.
  9. 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.dragTocItem calls window._moveHeading and 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 ### Added group. 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


Generated by Claude Code

Activity

  1. added
    Toc
    on Oct 16, 2026
  2. added this to the v2.3.0 milestone on Oct 19, 2026
  3. HMarzban commented on Nov 3, 2026

    @HMarzban
    CollaboratorAuthor

    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:

  4. HMarzban commented on Nov 5, 2026

    @HMarzban
    CollaboratorAuthor

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    FeatureTocUI

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions