diff --git a/solvway-admin-portal/app/lib/frameHtml.anchor.test.ts b/solvway-admin-portal/app/lib/frameHtml.anchor.test.ts
index 0cbd446..0e2b925 100644
--- a/solvway-admin-portal/app/lib/frameHtml.anchor.test.ts
+++ b/solvway-admin-portal/app/lib/frameHtml.anchor.test.ts
@@ -37,3 +37,14 @@ describe("frame script: same-page links", () => {
expect(post.mock.calls.filter(([d]) => (d as { type: string }).type === "colite-frame-anchor")).toHaveLength(0);
});
});
+
+describe("frame script: height report", () => {
+ it("reports the content's height, not the frame's own, so a short block can shrink below its start height", () => {
+ const post = vi.spyOn(window.parent, "postMessage").mockImplementation(() => {});
+ const root = document.documentElement;
+ vi.spyOn(root, "scrollHeight", "get").mockReturnValue(600);
+ vi.spyOn(root, "getBoundingClientRect").mockReturnValue({ height: 69.4 } as DOMRect);
+ runFrameScript("");
+ expect(post).toHaveBeenCalledWith({ type: "colite-frame-height", height: 70 }, "*");
+ });
+});
diff --git a/solvway-admin-portal/app/lib/frameHtml.ts b/solvway-admin-portal/app/lib/frameHtml.ts
index 22808d6..04307d8 100644
--- a/solvway-admin-portal/app/lib/frameHtml.ts
+++ b/solvway-admin-portal/app/lib/frameHtml.ts
@@ -15,10 +15,10 @@ export const FRAME_ANCHOR_MESSAGE = "colite-frame-anchor";
const ANCHOR_SOURCE = "^(?!reg-)[a-z0-9][a-z0-9-]{0,39}$";
const ANCHOR = new RegExp(ANCHOR_SOURCE);
-// Posts the document height to the parent page on load and whenever it changes. A click on a #name link
+// Posts the content height (not scrollHeight, which never drops below the frame itself) to the parent page on load and whenever it changes. A click on a #name link
// (add-page-anchor-links) asks the page to scroll instead: the frame is as tall as its content and never scrolls.
const FRAME_SCRIPT =
- `