IR56M "Preview the filled PDF" button does nothing (popup blocked after await)
Symptom¶
Pressing "Preview the filled IR56M PDF" did nothing β no new tab, no error toast. Reported by the owner 2026-06-29 (more pronounced on mobile).
Root cause¶
handlePreview in components/records/IR56MFilingsTab.tsx called window.open(url, '_blank') after
await fetch('/api/accounting/ir56m/fill') + await res.blob(). A window.open() invoked after an await
is no longer inside the user-gesture context, so popup blockers silently block it (reliably on mobile
browsers) β hence "nothing happened" with no error.
Fix¶
Open the tab synchronously within the click gesture (window.open('', '_blank')), then point it at the
PDF (win.location.href = url) once the blob is ready; fall back to a download if even the synchronous open
is blocked, and close the blank tab on error. Code fix landed with the T-047 phase-5 merge to main.
Note / blast radius¶
The Accounting β Tax β IR56M tab had the SAME window.open-after-await preview; it was eliminated in the
T-047 phase-5 rework (the preview now renders in the recipient modal via react-pdf β no popup). This
ticket fixes the Records-tab sibling, which keeps a new-tab preview. Other tabs (Vendor invoices, Bank
statements, etc.) window.open a KNOWN url synchronously in the click handler, so they are NOT affected;
only fetch-then-open previews carry this risk.
Renumber trail (2026-06-29)¶
Filed as I-013 on q3; on merge to main it collided twice with the Records team's rapidly-filed
tickets β I-013 (Service-Invoice XLSX β T-114) and I-014 (signed-WOPC Pending β T-089). Per the AGENTS.md
UID-collision rule ("whoever merges second renumbers"), this ticket moved I-013 β I-014 β I-015 (the
real next-free on main at merge time). Earlier commit messages on q3/the cherry-pick still read
i-013/i-014 (immutable history); all forward references resolve to I-015.
β Attestation: read AGENTS.md + checked the board by scope β symptom-level UI bug, ticketed per the rulebook; cross-linked to T-047 (the IR56M work) rather than opening a new task. Source: EOP Local Assistance (fork) Β· session edb0abc7-6373-449b-8e31-379fd38d391b (local Claude Code).