[object Object]

← back to Commercialrealestate

col-resize: don't enhance/pin HIDDEN tables (fleet regression fix)

986533664a4106f099bf839bd4a77e1c2ae5f488 · 2026-07-31 11:24:36 -0700 · Steve Abrams

Follow-up to ed0652f. syncTableWidth pins table.style.width to the sum of
<col> widths — but col-resize also enhances tables that are display:none
(cells measure 0 → clamped to MIN 40), so hidden tables were pinned to
40×ncols (e.g. index.html's 40 detail tables → 240px) and rendered as a
broken sliver when shown. Bail enhancement on zero-width (hidden) tables and
guard syncTableWidth the same way; hidden tables render fine untouched and
enhance once visible.

Verified: index.html hidden tables no longer enhanced (0 pinned); broker-grid
resize/sort/toggle/reorder still work; mls/lenders/sales render clean, 0
errors. Found via the yoloforever Cody-gate + verify-before-acting pass on the
shared-file blast radius. TK-10088.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

Files touched

Diff

commit 986533664a4106f099bf839bd4a77e1c2ae5f488
Author: Steve Abrams <steve@designerwallcoverings.com>
Date:   Fri Jul 31 11:24:36 2026 -0700

    col-resize: don't enhance/pin HIDDEN tables (fleet regression fix)
    
    Follow-up to ed0652f. syncTableWidth pins table.style.width to the sum of
    <col> widths — but col-resize also enhances tables that are display:none
    (cells measure 0 → clamped to MIN 40), so hidden tables were pinned to
    40×ncols (e.g. index.html's 40 detail tables → 240px) and rendered as a
    broken sliver when shown. Bail enhancement on zero-width (hidden) tables and
    guard syncTableWidth the same way; hidden tables render fine untouched and
    enhance once visible.
    
    Verified: index.html hidden tables no longer enhanced (0 pinned); broker-grid
    resize/sort/toggle/reorder still work; mls/lenders/sales render clean, 0
    errors. Found via the yoloforever Cody-gate + verify-before-acting pass on the
    shared-file blast radius. TK-10088.
    
    Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
---
 public/col-resize.js | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/public/col-resize.js b/public/col-resize.js
index 79e7785..a322990 100644
--- a/public/col-resize.js
+++ b/public/col-resize.js
@@ -66,6 +66,7 @@
   // to the exact sum of the column widths makes the <col> widths authoritative and
   // lets the table grow past its container into the overflow-x:auto scroll wrapper.
   function syncTableWidth(table, cols) {
+    if (table.getBoundingClientRect().width === 0) return;   // hidden — never pin garbage widths
     var sum = 0;
     for (var i = 0; i < cols.length; i++) sum += parseFloat(cols[i].style.width) || 0;
     if (sum > 0) table.style.width = Math.round(sum) + 'px';
@@ -87,6 +88,11 @@
     if (table.dataset.crDone === '1' || table.hasAttribute('data-no-resize')) return;
     var headers = headerCells(table);
     if (headers.length < 2) return;              // nothing meaningful to resize
+    // Don't enhance a HIDDEN table: its cells measure 0 → clamp to MIN, and
+    // syncTableWidth would then pin the table to MIN×ncols (e.g. 240px), so it
+    // renders as a broken sliver when later shown. Leave it untouched (renders
+    // fine at its natural CSS width); it enhances once a scan sees it visible.
+    if (table.getBoundingClientRect().width === 0) return;
     table.dataset.crDone = '1';
 
     var sig = tableSig(headers);

← b8c63bc crcp: make all stat tiles + enrichment bars drill to their f  ·  back to Commercialrealestate  ·  crcp list pages: resize handles survive sort/search re-rende 1c3f373 →