From 67057de214032b6069151e3a7977deb0eb42b9cc Mon Sep 17 00:00:00 2001 From: claude code agent 227 Date: Wed, 24 Jun 2026 00:47:29 +0300 Subject: [PATCH] test(editor): guard #146 contentDOM-first invariant + fix code-block comment (PR #147 review) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Addresses the #147 review (Approve with comments): - Add footnote-views.structure.test.tsx: a structural regression guard asserting the editable NodeViewContent is the FIRST child of FootnotesListView and FootnoteDefinitionView, with no contenteditable=false chrome before it. The whole #146 fix rests on this DOM-order invariant; the macOS caret symptom needs a real browser, but the order proxy is testable in jsdom. Stubs @tiptap/react so the views render as plain DOM — the test passes on the fixed order and fails on the pre-fix chrome-first order. - Reword the code-block-view comment: it claimed a "top-right overlay (the transclusion pattern)", but the menu stays fully in flow as a full-width row lifted via flex `order: -1` (the .codeBlock wrapper is a flex column). No overlay/absolute positioning. Co-Authored-By: Claude Opus 4.8 --- .../components/code-block/code-block-view.tsx | 6 +- .../footnote-views.structure.test.tsx | 91 +++++++++++++++++++ 2 files changed, 95 insertions(+), 2 deletions(-) create mode 100644 apps/client/src/features/editor/components/footnote/footnote-views.structure.test.tsx diff --git a/apps/client/src/features/editor/components/code-block/code-block-view.tsx b/apps/client/src/features/editor/components/code-block/code-block-view.tsx index 1b931926..1b67ddf6 100644 --- a/apps/client/src/features/editor/components/code-block/code-block-view.tsx +++ b/apps/client/src/features/editor/components/code-block/code-block-view.tsx @@ -50,8 +50,10 @@ export default function CodeBlockView(props: NodeViewProps) { {/* #146: the editable
 (contentDOM) MUST come first in the DOM.
           With the non-editable menu rendered before it, the browser's click
           hit-testing snapped the caret up one line. Render content first; the
-          menu follows and is positioned as a top-right overlay via CSS (the
-          transclusion pattern), so it no longer sits in-flow above the code. */}
+          menu is rendered after it and lifted back above visually via flex
+          `order: -1` (the `.codeBlock` wrapper is a flex column — see
+          code-block.module.css). It stays fully in flow as a full-width row
+          above the code: no overlay/absolute positioning. */}