Frontend polish: CDN-failure resilience, link safety, a11y, UX fixes - #5
Frontend polish: CDN-failure resilience, link safety, a11y, UX fixes#5LukasWallrich wants to merge 3 commits into
Conversation
- Guard every Chart.js / Plotly render entry point (typeof check) so a blocked CDN degrades individual charts to an inline message instead of throwing an uncaught ReferenceError that aborts the rest of loadData (tables, FAQ, data stamps). Adds shared chartLibMissing() helper. - FAQ markdown links: allow only http/https/mailto schemes (case-insensitive, trimmed); other schemes (e.g. javascript:) render as plain text. - index.html: add rel="noopener noreferrer" to all 24 target="_blank" anchors. - Citation Impact modal: close on Escape; move focus to the close button on open and restore it to the trigger on close. - Normalize GitHub repo casing to canonical lowercase forrtproject/fred-data (REMOTE_CSV_URL, CITATION_URL) to match FAQ_URL. - Citation Impact: show an immediate "Loading…" state on init, cleared on success, consistent with mc-loading/ao-loading. - Random Examples: replace biased sort(() => Math.random() - 0.5) with an unbiased Fisher–Yates shuffle. - Remove dead schema references (effect_o/effect_r/n_o/n_r/description) not present in flora.csv from formatDetailRow and bmSearchableText. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…load - The FAQ link allow-list now requires the whole trimmed URL to start with http:, https:, or mailto:, closing the control-character-prefix bypass and excluding protocol-relative/relative URLs. - Chart guards no longer declare CDN failure while the page is still loading: app.js runs before the chart libraries, so a fast cached data fetch could hit a guard while Chart.js was mid-download, permanently replacing a healthy chart. Before window load, guards now defer one retry to the load event; after load, a missing library is a real failure. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Codex review (gpt, read-only): REQUEST_CHANGES — two high findings, both addressed in 518cbbf:
Codex verified the rest cleanly: |
Codex re-check: the five trend-chart guards each registered their own load listener calling renderAllTrends. Retries are now deduped by function identity, with a shared retryAllTrends for the trend charts. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Codex re-verified the fix commit: URL validation sound, retry closures and load timing correct. One residual nit — the five trend-chart guards could each queue their own |
Part of a repo audit. Frontend-only changes (no build step; verified with
node --checkand element-ID cross-checks):new Chart/Plotlyrender entry point is now guarded — if a chart library fails to load (ad-blocker, offline), the affected chart shows an inline "Chart unavailable" message instead of an uncaught error that previously aborted table/FAQ/data-stamp initialization for the whole page.http:/https:/mailto:; other schemes (e.g.javascript:) render as plain text.rel="noopener noreferrer"added to all 24target="_blank"anchors inindex.html(JS-generated links already had it).forrtproject/fred-data(GitHub's canonicalfull_name) — two URLs usedFReD-datawhile a third used lowercase.sort(() => Math.random() - 0.5).effect_o/effect_r/n_o/n_r/descriptionnever exist inflora.csvand could never render.Deliberately does not touch the Mean Citedness sections of
app.js— those are fixed in #4.🤖 Generated with Claude Code