diff --git a/site/public/js/pw-crtc-collapse.js b/site/public/js/pw-crtc-collapse.js index eee1c6f..2f4b009 100644 --- a/site/public/js/pw-crtc-collapse.js +++ b/site/public/js/pw-crtc-collapse.js @@ -27,7 +27,6 @@ { key: "corporate tax comparison", label: "Corporate tax comparison (BC vs US)" }, { key: "canada telecom m&a", label: "Canada telecom M&A climate" }, { key: "step 6: canadian business banking", label: "Canadian business banking" }, - { key: "included: canadian wholesale", label: "Wholesale vendor directory" }, { key: "frequently asked questions", label: "FAQ", open: false }, { key: "us wholesale voice market", label: "US wholesale / DID restrictions" }, { key: "the growing burden", label: "The growing burden of a US carrier" }, @@ -79,6 +78,17 @@ return; } + // Guard against card-wrapped headings whose body is NOT a following + // sibling (e.g. an H2 alone in a flex header row inside a styled card). + // In that case we'd collect only the heading and produce an accordion + // that expands to nothing. Measure the real body text (excluding the H2) + // and bail out, leaving the section inline, if there's nothing to show. + var bodyText = nodes.reduce(function (acc, node) { + if (node === h2) return acc; + return acc + (node.textContent || ""); + }, "").replace(/\s+/g, " ").trim(); + if (bodyText.length < 200) return; + var details = document.createElement("details"); details.className = "pw-collapse"; if (cfg.open) details.open = true;