From 93c0a80b7d8b1158f538566ad950602d8c2b5571 Mon Sep 17 00:00:00 2001 From: MelekTaus Date: Mon, 5 Oct 2026 16:45:40 +0200 Subject: [PATCH] Keep a grip from laying out before it has a size The gate of a5184b3 was red: three tests in variable-rows.test.ts failed with "document is not defined". setGrabbable laid the grip out right away, so a row that had not been sized yet squeezed its label to nothing. The label then measured its text, and Node has no canvas for that. - setGrabbable only lays out again once the grip has a width. The first resize places the mark with the dots' inset anyway. Tests: - variable-rows + block-drag: 2 files, 13 tests, all green (variable-rows was 3 failed / 5 passed before) Co-Authored-By: Claude Opus 5.5 --- src/ui/widgets/Grip.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/ui/widgets/Grip.ts b/src/ui/widgets/Grip.ts index 27e8a9d1..b0bdc8ef 100644 --- a/src/ui/widgets/Grip.ts +++ b/src/ui/widgets/Grip.ts @@ -43,7 +43,9 @@ export class Grip extends Widget { setGrabbable(on: boolean): void { if (this.grabbable === on) return; this.grabbable = on; - this.layout(); + // Not laid out yet: the first resize places the mark, and squeezing it to nothing now would only + // make its label measure itself for no use. + if (this.w > 0) this.layout(); this.invalidate(); }