diff --git a/src/lib/npc-dialogue/DialogueText.tsx b/src/lib/npc-dialogue/DialogueText.tsx index c4669f5d..402b577a 100644 --- a/src/lib/npc-dialogue/DialogueText.tsx +++ b/src/lib/npc-dialogue/DialogueText.tsx @@ -329,12 +329,20 @@ function Countdown({ value }: { value: string }) { const remaining = target - now; if (remaining <= 0) return ready; + // Each unit is its own inline-flex cell so the gap between them is controlled + // (a monospace font's raw space reads wide/odd inline with proportional text). return ( - {formatRemaining(remaining)} + {formatRemaining(remaining) + .split(" ") + .map((unit, i) => ( + + {unit} + + ))} ); } diff --git a/tests/int/npc-dialogue-interpolate.int.spec.ts b/tests/int/npc-dialogue-interpolate.int.spec.ts index 91c60597..9f71821b 100644 --- a/tests/int/npc-dialogue-interpolate.int.spec.ts +++ b/tests/int/npc-dialogue-interpolate.int.spec.ts @@ -394,6 +394,11 @@ describe("markup accumulation + links + countdowns", () => { const empty = render("x{cd|}y"); expect(empty).toContain("xy"); expect(empty).not.toContain("cd|"); + // Each unit is its own inline-flex cell (CSS gap) so the gap between units + // is controlled instead of the raw monospace space reading wide/odd inline. + const html = render(`{cd|${future}}`); + expect(html).toContain("inline-flex"); + expect(html.match(/whitespace-nowrap/g)?.length).toBe(2); }); it("formats remaining time compactly", () => {