From 7e6ae3b64646e16d52753738cd577b0bee0b2860 Mon Sep 17 00:00:00 2001 From: littlefrontender Date: Fri, 10 Jul 2026 18:14:36 +0400 Subject: [PATCH] fix: correct parent element reference in TestStepContent to prevent layout issues - Updated the reference to the block's node-view box to use the closest `.bn-block-content` instead of the immediate parent, addressing a layout problem that caused incorrect width readings and unintended vertical layout flips. --- src/editor/blocks/step.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/editor/blocks/step.tsx b/src/editor/blocks/step.tsx index 3168719..9042f3d 100644 --- a/src/editor/blocks/step.tsx +++ b/src/editor/blocks/step.tsx @@ -510,7 +510,11 @@ function TestStepContent({ const viewTransitionRef = useRef(false); useEffect(() => { - const el = containerRef.current?.parentElement; + // Measure the block's node-view box (the step's real available width). The + // immediate parent is a `display: contents` anchor with no box, so its width + // reads as 0 and would wrongly force the vertical layout — in horizontal view + // that spurious flip remounts the editor and collapses the step on open. + const el = containerRef.current?.closest(".bn-block-content"); if (!el) return; const observer = new ResizeObserver((entries) => { for (const entry of entries) {