From c032d65df168c3d4919a7ed65bd9e8ef7cce224f Mon Sep 17 00:00:00 2001 From: masnwilliams <43387599+masnwilliams@users.noreply.github.com> Date: Sat, 29 Aug 2026 15:48:48 +0000 Subject: [PATCH] Contain wide table overflow --- lib/docs/overlay.test.ts | 10 ++++++++++ lib/docs/overlay.ts | 3 ++- 2 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 lib/docs/overlay.test.ts diff --git a/lib/docs/overlay.test.ts b/lib/docs/overlay.test.ts new file mode 100644 index 0000000..214842a --- /dev/null +++ b/lib/docs/overlay.test.ts @@ -0,0 +1,10 @@ +import { describe, expect, it } from "vitest"; +import { OVERLAY_SCRIPT } from "./overlay"; + +describe("OVERLAY_SCRIPT", () => { + it("keeps wide tables within their own horizontal scroll area", () => { + expect(OVERLAY_SCRIPT).toContain( + "table{display:block;max-width:100%;overflow-x:auto}" + ); + }); +}); diff --git a/lib/docs/overlay.ts b/lib/docs/overlay.ts index 7d4cbdc..9ac50dc 100644 --- a/lib/docs/overlay.ts +++ b/lib/docs/overlay.ts @@ -405,7 +405,8 @@ export const OVERLAY_SCRIPT = String.raw` // darkest (3+). .jh-focus intensifies the focused anchor's segments; .jh-dim // fades non-focused overlapping highlights when a focus is active. st.textContent = - "span[data-jh-seg]{cursor:pointer;transition:background .12s,opacity .12s,box-shadow .12s}" + "table{display:block;max-width:100%;overflow-x:auto}" + + "span[data-jh-seg]{cursor:pointer;transition:background .12s,opacity .12s,box-shadow .12s}" + "span[data-jh-seg].d1{background:#fff3bf;border-bottom:1px solid #f1d96b}" + "span[data-jh-seg].d2{background:#ffe08a;border-bottom:1px solid #e8c44e}" + "span[data-jh-seg].d3{background:#ffc94d;border-bottom:1px solid #e0a92e}"