Repository navigation
Description
Part of #499. Read the parent first. Step 8. It can run beside #507. Start only after #502 records the D7 ruling.
Work on main. Read AGENTS.md, apps/webapp/CLAUDE.md and apps/webapp/src/components/TipTap/CLAUDE.md first. Do the steps in this order.
Summary
- Today. A TOC row has two drop halves, before and after, and no "inside" zone (read from code, at 85295b8:
pointerCollisionDetection.ts:33-47). A folded row never opens during a drag (read from code: no timer incomponents/toc/, see Current behaviour). - After. A drop in the middle of a heading row puts the dragged set inside that heading, as its first sub-heading. The row shows an inside highlight while the pointer is there. Holding 500ms over a folded row opens it, so its sub-headings become targets.
- Why. R5 asks for Edward's folder gesture. In his words: "you get a smaller headin by putting it "inside" another a larger heading." The full quote is on [Tracking] Move TOC sections like folders: cascade, drop inside, and a menu path #499.
- Release. This is the last code slice. This slice follows G1, as ruled on the tracker.
Maintainer rulings that bind this issue
The full text is on #499. One line each:
- R1. An inside drop changes the dragged heading's level by
d. Every sub-heading in the set shifts by the samed. - R2. Think like a flat document. An inside drop can capture a following deeper heading. Do not add a rule that blocks capture.
- R3. The Title row has no grip, nothing drops above it, and its level never changes. A drop inside the Title is allowed.
- R4. Never block a drop because of depth. A sub-heading that would pass H6 stays at H6 (squash). Never read the children to decide whether a drop is allowed.
- R5. Drop ON a heading means "put it inside", with full micro-interactions. A hallway test runs before release.
- R6. A set is one heading plus its whole subtree. There is no multi-select.
Depends on / Blocks
Depends on. These pieces exist when this issue starts. Use them; do not rebuild them. By Step 8 the earlier children have rewritten most of the files linked below. If a file moved, find the function by its role.
- Move a TOC section with its sub-headings and keep the Title fixed #500:
planMoveandapplyMoveintoc/utils/moveHeading.ts. Theinsidearm inserts atT.childStartat levelmin(T.level + 1, 6), with the R1 cascade and the R4 squash. The'inside'value is already in the drop-position union in all six places, as Move a TOC section with its sub-headings and keep the Title fixed #500 Step 1 says. - Add Move rows to Section options and open the menu from the grip #501:
TocItem.isTitleexists. - Rebuild the TOC drop hit test so folded rows and gaps land right #503:
hitTestDropintoc/dnd/utils.ts. It is the rect-contains hit test over visible rows only, with the canonical gap rule ("before the lower row"; "after" only below the last visible row). Its rect type isTocRowRect(top,bottom). Its zone-edge band isTOC_ZONE_HYSTERESISintoc/dnd/types.ts. It deletesgetPointerPosition,findDropTargetandTARGET_HYSTERESIS. It also gives the rect cache rebuild in auseLayoutEffectkeyed onflatItemsand the fold state, which re-runs the hit test at the last pointer. Its test file istoc/dnd/hitTestDrop.test.ts. - Set the drag level from the row above and indent the drop line #504: the D1 level rule at a gap and the indented drop line (D8). An inside drop does not use either.
- Show where a moved section landed after a TOC move #506:
pendingSettle, the open-the-path step, the TOC row scroll, the flash and the Undo toast (D15 as ruled). - Build one preview of the new TOC move visuals for design-system rulings #502: the D7 ruling for the inside highlight. It is a design-system ruling.
- Start a TOC drag from the whole row and cancel it safely #505, if merged: its cancel paths (lock on mid-drag, source deleted by a peer) must also stop the spring timer.
Blocks. #509. It tests this gesture in tasks 2 and 5.
Current behaviour
All links are pinned to 85295b8cf. They show the code before the earlier children land. Use them to understand the gap, not as edit targets.
- A row splits into two halves at its middle, with a 4px dead zone. There is no middle band (read from code:
pointerCollisionDetection.ts:33-47). Rebuild the TOC drop hit test so folded rows and gaps land right #503 deletes this function. DropTarget.positionis'before' | 'after' | null(read from code:dnd/types.ts:11-17).- No timer runs during a drag. A grep of
components/toc/findssetTimeoutonly inTocTickRail.tsxand theuseToc.ts200ms first-build retry (read from code). - The rect cache is built at drag start and rebuilt only on a captured scroll (
useTocDrag.ts:75-92,:115; read from code). An open mid-drag would leave stale rects. Rebuild the TOC drop hit test so folded rows and gaps land right #503 fixes the rebuild. - During a drag every heading row has
pointer-events: none. Its hover, focus and active fills are forced totransparent !important(read from code:_tableOfContents.scss:35-61). So CSS:hovercannot drive an inside highlight. - The nearest "target of an action" fill is
context-menu-active, primary 15% (read from code:_tableOfContents.scss:90-92).TocDesktopsets it withclassList(TocDesktop.tsx:57-72; read from code). - The chat-open
menu-activefill is primary 14% on--pad-well(read from code:_daisyui.scss:14-20). A fill-only highlight would show almost no change on a chat-open row (secondary / inferred). - A folded row hides its children with
display: none(read from code:_tableOfContents.scss:95-97). - The chevron calls
editor.commands.toggleFold(id)(read from code:useToc.ts:94-100). The command returnstrueand does nothing while that heading animates (heading-fold.ts:41-42; read from code). The fold animation is 350ms (heading-fold-plugin.ts:33; read from code). - The TOC reads an
unfoldingheading as open, so its children show at once (read from code:useToc.ts:80). A fold change rebuilds the TOC at once, with no throttle (useToc.ts:116-126; read from code). - The Title row exists only when the Title has text.
buildTocItemsskips empty headings (read from code:useToc.ts:78). INDICATOR_Y_HYSTERESIS(8px) only keeps the painted line's Y steady. It does not choose a zone (read from code:utils.ts:169-172).- A one-line desktop row has
min-h-8, which is 32px (read from code, not measured:TocRow.tsx:47). The design system names a "real 36px row pitch" (design-system.md:405). These are two facts: the rect height and the row-to-row spacing. Step 0 measures both. - No unit test exists under
components/toc/today (read from code). The house convention is a*.test.tsfile beside its source, for exampleapps/webapp/src/components/TipTap/block-style/blockStyle.test.ts(read from code). Jest runs in jsdom (read from code:jest.config.js:10).
Target behaviour
Zones per row
Each visible row splits by its cached rect height h = bottom - top. The edge size is e = clamp(round(0.25 × h), 8px, 12px). This is an implementer default; tune it in the browser.
| Row | Zones |
|---|---|
| Leaf, level 1–5 | before (top e) / inside (middle) / after (bottom e) |
| Folded row with children, level 1–5 | before / inside / after. Inside arms the spring timer. |
| Open row with visible children, level 1–5 | before (top e) / inside (the rest). No after. |
| H6 row (D5) | before (top half) / after (bottom half). No inside. |
Title row (isTitle) |
inside (the whole row). No before (R3), no after. |
| Ghost (the set), header row, rows inside a folded ancestor | none |
On a 32px row this gives 8px before, 16px inside and 8px after (secondary / inferred until Step 0 measures the row).
- Zone to drop. The inside zone of row T is
{ position: 'inside', targetId: T }. Before and after keep the canonical gap rule from Rebuild the TOC drop hit test so folded rows and gaps land right #503. Never add an "after" normaliser. - Missing zones merge. A zone a row lacks goes to its neighbour. Nothing is drawn as blocked.
- Gaps between rects. A pointer between two rects keeps the Rebuild the TOC drop hit test so folded rows and gaps land right #503 rule: the nearer edge zone of the nearer row.
- Title as the last visible row. When every other row is the ghost set, the Title is the last visible row. The space below it is still inside (H2). There is no H1 gap there.
- Empty Title. With an empty Title there is no Title row. The first visible row is a normal heading with a before zone. A drop there lands after the empty Title heading, never before it (R3).
- H6 is not a depth block. The gaps above and below an H6 row stay open, so R4 holds.
- Hysteresis. A 2px band at each zone edge, from
TOC_ZONE_HYSTERESIS. Leaving a zone needs the pointer 2px past its edge. A 4px band would eat half of an 8px zone (secondary / inferred).
What an inside drop does
The planner from #500 does the work. This issue only sends the drop.
- The set lands as the first child of T, at
T.childStart, after T's body text and before T's first sub-heading (D4). - The dragged heading becomes H
min(T.level + 1, 6). Its sub-headings shift by the samed(R1) and stop at H6 (R4). - If T's first sub-heading skips a level, the dropped heading captures it (R2). Measured on a scratch copy, case 4b-skip:
H2:T{H3:X{H4:C1}}. - A drop inside the Title lands after the Title's body, before the first heading, at H2. Measured, case 5c:
H1:Title t0 H2:B b0 H2:A a0. - The drag passes no level for an inside drop. The D1 gap rule does not apply.
Inside highlight (D7 as ruled)
Build exactly what #502 records. The recommended shape is below.
- Class
is-drop-insideon the target.toc__row, with thecontext-menu-activefill (primary 15%) plusoutline: var(--focus-ring-soft); outline-offset: -2px. - It is instant on and instant off. No tween.
- While it shows, the drop line hides. Show the line or the highlight, never both.
- The rule must beat
.is-dragging … :hover, :focus, :active { background-color: transparent !important }.
Spring-open (D10)
- The timer key is
${targetId}:${zone}. When the key becomes<folded id with children>:inside, start a 500ms timer. - Any key change stops the timer. A new entry always waits the full time. There is no countdown cue; the inside highlight is the only cue.
- On fire, call
editor.commands.toggleFold(id), as the chevron does. The row stays open after the drag. - After the open, the rect cache rebuilds before paint and the hit test re-runs at the same pointer. The row is now "open with visible children", so a still pointer stays inside it.
- Never fold anything during a drag.
- At settle, a folded inside target opens through the open-the-path step in Show where a moved section landed after a TOC move #506. That covers a quick drop before the timer fires.
Peer evidence
- Notion nests sidebar pages this way: "Nest pages by dragging one into another. You'll see the selected page highlight blue." (primary source: https://www.notion.com/help/navigate-with-the-sidebar).
- Atlassian's tree hitbox uses quarter bands: "const quarterOfHeight = borderBox.height / 4;" (primary source:
attach-instruction.ts:15-35). react-arborist uses the same split (primary source:compute-drop.ts:6-18). - Atlassian has no "after" zone on open rows: "For expanded tree items, do not allow
"reorder-after"operations" (primary source:about.mdx:192-196). - 500ms is the common spring delay. Atlassian: "If a user drags over a collapsed tree item with the "combine" operation for 500ms, then the collapsed tree item should expand (and should stay expanded even after the drag finishes)" (primary source: https://atlassian.design/components/pragmatic-drag-and-drop/design-guidelines). VS Code uses 500 (primary source:
abstractTree.ts:89-113). - None of Google Docs, Word or Notion drops a heading inside another heading (secondary / inferred from their help pages). R5 is a deliberate exception under
AGENTS.md:151. [Tracking] Move TOC sections like folders: cascade, drop inside, and a menu path #499 records it.
Micro-interactions
This issue owns steps 4 to 6 of the Drag timeline on #499. It builds the inside-zone part of step 3. The card fade, the flash, the scroll and the toast after release belong to #506.
| # | Moment | What happens | Timing and token | Reduced motion |
|---|---|---|---|---|
| 3 | Pointer enters an inside zone | is-drop-inside turns on. The drop line hides. |
Instant. No tween. | Same. |
| 3b | Pointer leaves the inside zone (2px past the edge) | The class turns off. The line shows for the new gap. | Instant. | Same. |
| 5 | Spring wait, folded row with children | The 500ms timer runs. Nothing else changes on screen. | TOC_SPRING_OPEN_MS = 500, a functional constant, not a motion token. |
Keeps its timing (functional delay, apps/webapp/CLAUDE.md §Motion System). |
| 6 | Spring fire | toggleFold opens the row. The chevron turns. The editor crinkle plays. The children appear at once. |
Chevron 160ms (existing literal). Crinkle 350ms (FOLD_ANIMATION_MS). |
The chevron turn stops (existing). |
| 6b | Same frame, before paint | The rect cache rebuilds. The hit test re-runs at the last pointer. The highlight stays on the opened row. | Before paint (useLayoutEffect). |
Same. |
| 10 | Release in an inside zone | One transaction through the planner. Settle takes over. | Owned by #506: 80ms --motion-overlay-out card fade, --motion-flash-hold flash. |
Owned there. |
Motion rules that apply here (read from code):
- No transform on or above ProseMirror hosts, and never
transition-all(apps/webapp/CLAUDE.md:175). - No
animate-pulseand no pulse keyframes (apps/webapp/CLAUDE.md:25). - No new z-tier (
apps/webapp/CLAUDE.md:168).
Implementation steps
Step 0. Measure and confirm the gates
Post the results as a comment on this issue before you write code.
- Open the playground at 1440×900 in a visible tab, light theme. Use a pad with one-line headings and one heading long enough to wrap.
- In DevTools, read
getBoundingClientRect()onli.toc__item > .toc__row. Post four numbers: a one-line row height, a wrapped row height, the gap between two row rects, and the row pitch (top to top). - Fix
efrom the measured heights. Post the zone pixel sizes for both rows. - Confirm on this issue that D5 and D10 are ruled, and on Build one preview of the new TOC move visuals for design-system rulings #502 that D7 is ruled. Confirm on [Tracking] Move TOC sections like folders: cascade, drop inside, and a menu path #499 that G1 is ruled. Stop if any is open.
Step 1. Add the zone resolver and the constant
Files: apps/webapp/src/components/toc/dnd/types.ts (today) and apps/webapp/src/components/toc/dnd/utils.ts. These links show the code before #503. That issue deletes getPointerPosition, findDropTarget and TARGET_HYSTERESIS, and adds hitTestDrop, TocRowRect and TOC_ZONE_HYSTERESIS. Build on what it leaves.
- Add
TOC_SPRING_OPEN_MS = 500indnd/types.ts, besideTOC_ZONE_HYSTERESIS. - Add the edge sizes (8px and 12px) as named constants in the same file. Reuse
TOC_ZONE_HYSTERESISfor the 2px zone-edge band. Add no second hysteresis constant. - Write one pure function,
resolveRowZone, indnd/utils.tsbesidehitTestDrop. Its input is the pointer Y, aTocRowRect(top,bottom), the row kind (leaf | folded | open | h6 | title) and the previous zone. Its output isbefore | inside | after. It reads no DOM. Rows with no zones never reach it. - Row kind comes from the flat item, in this order:
isTitlegivestitle;level === 6givesh6;openmeansitem.openand at least one child row that is not the ghost set and not incollapsedIds;foldedmeans!item.openand at least one child; every other row isleaf. So an open row whose only children are the dragged set is aleafand keeps its after zone. - If
INDICATOR_Y_HYSTERESISstill exists, leave it alone. It steadies the painted line only, and the line hides in inside mode.
Step 2. Map the inside zone to a drop
File: hitTestDrop in apps/webapp/src/components/toc/dnd/utils.ts, as #503 leaves it (before that issue, the hit test was findDropTarget, utils.ts:92-181).
- An inside zone of row T returns
{ position: 'inside', targetId: T }with no level and no indicator Y. - Before and after zones keep the canonical gap rule unchanged.
- In
DropIndicatorPortal's mount condition (TocDesktop.tsx:166-172today), skip the line when the position isinside. - In
handleDragEnd(todayuseTocDrag.ts:176-214), pass the inside drop toplanMoveas it is. Do not compute a level.
Step 3. Build the inside highlight
Files: apps/webapp/src/components/toc/tocClasses.ts (:6-29), apps/webapp/src/styles/components/_tableOfContents.scss (:35-61), apps/webapp/src/components/toc/TocItemBody.tsx, and a new store file in apps/webapp/src/stores/.
- Add
dropInside: 'is-drop-inside'toTOC_CLASSES. KeeptocClasses.tsand the SCSS in step. - Add the rule inside the
.toc__list.is-dragging .toc__item > .toc__rowblock, after the transparent rule. Use the D7 recipe as ruled, with!importanton the fill. Never edit the lockedglobals.scss;--focus-ring-softis read from it (globals.scss:410). - Derive the class in render, not with
classList. React rewrites a row'sclassNamewhenmenu-focusormenu-activeflips. A spring-open crinkle can move the editor scroll and flipmenu-focusmid-drag (secondary / inferred). AclassListclass would vanish then. - Recommended wiring: keep
dropInsideIdin a small Zustand store inapps/webapp/src/stores/, besidefocusedHeadingStore.ts(focusedHeadingStore.ts). Export it fromstores/index.ts, asfocusedHeadingStoreis (index.ts:6). Read it inTocItemBodywith a boolean selector,(s) => s.dropInsideId === item.id. This is the house pattern forisFocusedandisActive(TocItemBody.tsx:48-49; read from code). Only two rows re-render per change, so rowmemostill holds. - The drag hook writes
dropInsideIdwhen the target or zone changes, and clears it on drag end, cancel and unmount.
Step 4. Add the spring timer
File: apps/webapp/src/components/toc/hooks/useTocDrag.ts (today the move handler is :129-167).
- Keep the timer id and its key in refs, not React state, so a tick never re-renders the list.
- On each hit-test result, build the key
${targetId}:${zone}. If it differs from the stored key, clear the timer and store the new key. - Arm only when the zone is
insideand the row kind from Step 1 isfolded. WaitTOC_SPRING_OPEN_MS. - On fire, read the fold state from
headingFoldPluginKey.getState(editor.state). If the heading is no longer folded, do nothing. If it is still animating, start one more full wait with the same key, becausetoggleFoldwould do nothing. - Otherwise call
editor.commands.toggleFold(id), with the editor fromuseStore.getState().settings.editor.instance. - Clear the timer on a key change, drag end, drag cancel (Esc included), unmount, and every cancel path from Start a TOC drag from the whole row and cancel it safely #505 (lock on mid-drag, source deleted by a peer).
- Check that the Rebuild the TOC drop hit test so folded rows and gaps land right #503 layout-effect rebuild runs after the fold change and re-runs
hitTestDropat the last pointer. If it is keyed onflatItemsonly, add the fold state to its keys.
Step 5. Browser checks while you build
Use real pointer events in a visible tab. Drive them with the Claude in Chrome computer tool drag (left_click_drag), or with DevTools Input.dispatchMouseEvent (mousePressed, several mouseMoved, mouseReleased). cy.dragTocItem calls window._moveHeading and skips dnd-kit, so it proves nothing about zones, the highlight or the timer.
- Hold over a folded row's inside zone. Check that the crinkle does not shift the editor scroll mid-drag. If it does, report it on this issue before you change anything.
- Hold still after the spring fires. The highlight must stay on the opened row with no pointer move.
- Force a
menu-focusflip mid-drag (scroll the editor with the wheel). The highlight must stay.
Step 6. Docs
docs/DEMO.md§Moving a section (:222-231). Add two sentences: "Drop on a heading to put it inside." and "Hold over a folded heading to open it." Keep the text that Move a TOC section with its sub-headings and keep the Title fixed #500 and Set the drag level from the row above and indent the drop line #504 wrote..cursor/docs/design-system.md: update the TOC rows "drag states" row (:401) and the State language "drag" row (:282) with the inside highlight, exactly as the D7 ruling approves. If the D7 ruling approves the-2pxinset offset, also update the--focus-ring-softtoken row (:205). Today that row names onlyoutline-offset: 1px(read from code). This follows the row-to-child table on Build one preview of the new TOC move visuals for design-system rulings #502. This is a locked file. Change only those rows.apps/webapp/CHANGELOG.md: one line under## [Unreleased],### Added.
End with a review checkpoint. Do not commit. This slice follows G1, as ruled on the tracker.
Out of scope
- A modifier key that turns off drop-inside, as Scrivener's Option key does. Only if wrong inside drops are common.
- A drag-card caption that repeats the target. Only if hallway task 2 fails, and it needs a design-system ruling.
- A drop inside on the phone (D27).
- A tint on the target's visible children, as VS Code does. Only if the hallway test asks for it.
- A countdown cue during the spring wait. It would need a design-system ruling.
- The release gate. G1 on [Tracking] Move TOC sections like folders: cascade, drop inside, and a menu path #499 owns it.
- Siblings. The planner, the gap rule, the D1 level rule, the D8 line, the settle visuals and the a11y phrases belong to the issues listed under Depends on.
Decisions
The recommended answer comes first. Owner: the maintainer. Post the D5 and D10 rulings on this issue, as the tracker table names. Post the D7 ruling on #502.
- D5. Does an H6 row have an inside zone? Recommended: no. It splits 50/50 into before and after.
- Reason: a drop inside H6 would squash to an H6 sibling, so an inside highlight would show the wrong result. The gaps stay open, so R4 holds.
- Alternative: keep the zone and accept the squash to a sibling.
- D10. What are the spring-open rules? Recommended: 500ms in the inside zone of a folded row with children, then
toggleFold. The row stays open after the drag. The crinkle plays and the fold is saved, as a chevron click does. No countdown cue.- Reason: VS Code, GTK 3, WinUI and Atlassian keep a spring-opened row open (primary sources, listed on [Tracking] Move TOC sections like folders: cascade, drop inside, and a menu path #499).
toggleFoldnever touches Find state. Only a foldsetresets it (caret-find-plugin.ts:307-311; read from code). - Alternative: no spring-open. The person opens the fold before the drag. A quick drop inside a folded row still opens it at settle, through Show where a moved section landed after a TOC move #506.
- Rejected on the tracker (D11): a session-only fold that folds back after the drag. Do not offer it again.
- Reason: VS Code, GTK 3, WinUI and Atlassian keep a spring-opened row open (primary sources, listed on [Tracking] Move TOC sections like folders: cascade, drop inside, and a menu path #499).
- D7. How does the inside highlight look? (design-system ruling, owned by Build one preview of the new TOC move visuals for design-system rulings #502) Recommended:
is-drop-insidewith thecontext-menu-activefill plusoutline: var(--focus-ring-soft); outline-offset: -2px, instant.- Reason: it reuses the "target of an action" fill. The inset outline differs from the outside keyboard ring. It shows a change on a chat-open row and does not rely on colour alone (SC 1.4.1).
- Alternative: fill only, which shows almost no change on a chat-open row.
- This issue builds what that ruling records, and lists the catalog change as "(locked)".
Acceptance criteria
- D5 and D10 are ruled on this issue. Build one preview of the new TOC move visuals for design-system rulings #502 records D7. G1 is ruled on [Tracking] Move TOC sections like folders: cascade, drop inside, and a menu path #499.
- The Step 0 comment gives the one-line row height, the wrapped row height, the gap between rects and the row pitch, all measured.
- With real pointer events, a drop in the middle of a leaf H2 row puts the set inside it as its first sub-heading, at H3. Its sub-headings cascade by the same step.
- An inside drop on an H2 row whose first sub-heading is H4 puts the set at H3, and the H4 now sits inside the dropped heading (R2, case 4b-skip).
- A drop inside an H5 row with a deep set squashes the overflow at H6 and refuses nothing.
- A drop on the Title row lands right after the Title's body, before the first heading, at H2.
- A pointer anywhere on a Title row with text shows the inside highlight and never a drop line above the Title (R3).
- With an empty Title, there is no Title row. A drop in the before zone of the first visible row lands after the empty Title heading, never before it.
- An H6 row never shows the inside highlight. Its top half gives the gap above it, and its bottom half gives the gap below it.
- An open row with visible children has no after zone. Its lower part is inside.
- An open row whose only children are the dragged set acts as a leaf and keeps its after zone.
- The inside highlight and the drop line never show at the same time.
- Holding 500ms over a folded row's inside zone opens it. Its children become targets with no pointer move, and the highlight stays on the opened row.
- Leaving the inside zone before 500ms opens nothing. Re-entering waits the full 500ms again.
- Esc during the wait cancels the drag and opens nothing.
- A drop inside a folded row before the timer fires opens that row at settle, and the moved row is visible.
- Nothing folds during a drag. With D10 ruled as recommended, the spring-opened row stays open after the drop and after a cancel.
- The crinkle does not shift the editor scroll mid-drag, or the shift is reported on this issue.
- The inside highlight is visible on an idle row, a
menu-focusrow and a chat-open (menu-active) row, in light, dark and dark high contrast, at 1440×900 in a visible tab. - The highlight survives a
menu-focusflip mid-drag. -
dnd/types.tshas one zone-edge hysteresis constant,TOC_ZONE_HYSTERESIS.TOC_SPRING_OPEN_MSsits beside it. - No new token, size, radius, shadow or ink step lands without a recorded ruling.
- This slice follows G1, as ruled on the tracker.
-
bun run check:pushpasses, and the TOC Cypress spec passes. -
docs/DEMO.md, the design-system catalog rows and the CHANGELOG line are in the same change.
Verification
Static checks (Bun only):
bun run --filter @docs.plus/webapp typecheck
bun run lint
bun run lint:styles
# or all three:
bun run check:pushUnit test (allowed under AGENTS.md §Test Policy, because the zone resolver has dense branching):
- File:
apps/webapp/src/components/toc/dnd/hitTestDrop.test.ts, the file Rebuild the TOC drop hit test so folded rows and gaps land right #503 creates. Add aresolveRowZoneblock there. It uses plainTocRowRectvalues ({ top, bottom }), so it needs no DOM setup. - Failure mode, in one sentence: a pointer in the lower edge of an open row, or in an H6 row's middle, resolves to
inside. - Cover the five row kinds and the
TOC_ZONE_HYSTERESISedge band. Prove the test by sabotage: break one branch, watch it fail, restore it, watch it pass.
bun run --filter @docs.plus/webapp testDo not use bun run test:unit here. It also runs the extension gates (read from code: scripts/run-tests.sh:41), which take about 45 minutes (secondary / inferred).
E2E: start make dev-local and read the WEBAPP port. Then run the editor scope:
BASE_URL=http://localhost:<WEBAPP port> bash scripts/run-tests.sh --e2e --scope editorThe spec is apps/webapp/cypress/e2e/editor/toc/toc-render-and-drag.cy.js. It proves planner order only. Add no Cypress zone test unless a real-pointer driver is shown to reach dnd-kit.
Browser checks:
- Playground:
http://localhost:<WEBAPP port>/editor?localPersistence=true&docName=toc-drag-lab. It haswindow._editor,window._moveHeadingandwindow._createDocumentFromStructure. - Use the hallway seed outline from Run the TOC move hallway test before drop inside ships #509, or any outline with a folded H2, a leaf H2, an H2 whose first sub-heading is H4, an H5 with sub-headings, and an H6.
- Drive real pointer events in a visible tab at 1440×900, with the Claude in Chrome
computertool drag or DevToolsInput.dispatchMouseEvent. Checkdocument.visibilityState === 'visible'first; a hidden tab runs norequestAnimationFrame. - Repeat the highlight check in light, dark and dark high contrast. Switch the theme in Settings > Appearance (Dark, then High contrast). Or set
data-themeon<html>todocsplus-dark, thendocsplus-dark-hc(read from code:globals.scss:67,:126). - Never run
next buildagainst a live dev server.
Docs to update
docs/DEMO.md§Moving a section: the two new sentences..cursor/docs/design-system.md: the TOC rows "drag states" row (:401) and the State language "drag" row (:282), as the D7 ruling approves (locked). Also the--focus-ring-softtoken row (:205), only if the D7 ruling approves the-2pxoffset.apps/webapp/CHANGELOG.md: one### Addedline under## [Unreleased].
Read first
AGENTS.md§Test Policy and §Workflow And Review Expectations.apps/webapp/CLAUDE.md§Webapp Module Layers, §TOC And Heading Actions, §Motion System (motion v1) and §Heading Fold Crinkle.apps/webapp/src/components/TipTap/CLAUDE.md§Heading Schema and §Editor Performance..cursor/docs/design-system.md§Change protocol (locked), §State language and §Table of contents.CONTEXT.md§Pad outline.- Root
CLAUDE.md§Settled: the TOC channel-map rework and the tick rail rules stay as they are.
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). A drop onto a heading is not built, and there is no spring-open.Left:
HMarzban commentedon Nov 5, 2026
Progress 2026-11-05 (8d4ef6057, pushed): a drop onto the middle half of a row nests the section inside it as its last child. The row gets
is-drop-target(an inset primary ring), the DS-12 rail lights when the row has children, and a folded row opens after the drop. Not built: spring-open while hovering a folded row during a drag (D10). Per #509, the hallway test should still run before this is called done.HMarzban commentedon Nov 5, 2026
Closed as done in the current version (maintainer ruling 2026-11-05). A drop onto a row nests the section as its last child (8d4ef60). Spring-open while hovering a folded row is not built, and it is not planned. The hallway test in #509 is closed as not planned.