Skip to content

Fix broken dashboards: inject theme-toggle/back-to-top/mermaid bootstrap on all 126 dashboard pages#2480

Merged
pethers merged 6 commits into
mainfrom
copilot/fix-broken-dashboard-pages
May 14, 2026
Merged

Fix broken dashboards: inject theme-toggle/back-to-top/mermaid bootstrap on all 126 dashboard pages#2480
pethers merged 6 commits into
mainfrom
copilot/fix-broken-dashboard-pages

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 14, 2026

  • Review new PR comment and identify actionable review thread items.
  • Inspect current implementations in cypress/support/commands.js and tests/dashboard-pages.test.js.
  • Apply minimal fixes for attribute assertion semantics and bootstrap quote-style/order assertions.
  • Run targeted tests for modified files.
  • Run required validation checks (including CI/workflow investigation and parallel validation).
  • Reply to the new PR comment with commit hash and evidence.

Copilot AI and others added 2 commits May 14, 2026 10:37
@github-actions github-actions Bot added html-css HTML/CSS changes javascript JavaScript code changes testing Test coverage refactor Code refactoring size-xl Extra large change (> 1000 lines) labels May 14, 2026
@github-actions
Copy link
Copy Markdown
Contributor

🏷️ Automatic Labeling Summary

This PR has been automatically labeled based on the files changed and PR metadata.

Applied Labels: html-css,javascript,testing,refactor,size-xl

Label Categories

  • 🗳️ Content: news, dashboard, visualization, intelligence
  • 💻 Technology: html-css, javascript, workflow, security
  • 📊 Data: cia-data, riksdag-data, data-pipeline, schema
  • 🌍 I18n: i18n, translation, rtl
  • 🔒 ISMS: isms, iso-27001, nist-csf, cis-controls
  • 🏗️ Infrastructure: ci-cd, deployment, performance, monitoring
  • 🔄 Quality: testing, accessibility, documentation, refactor
  • 🤖 AI: agent, skill, agentic-workflow

For more information, see .github/labeler.yml.

Copilot AI requested a review from pethers May 14, 2026 10:54
@github-actions
Copy link
Copy Markdown
Contributor

🔍 Lighthouse Performance Audit

Category Score Status
Performance 85/100 🟡
Accessibility 95/100 🟢
Best Practices 90/100 🟢
SEO 95/100 🟢

📥 Download full Lighthouse report

Budget Compliance: Performance budgets enforced via budget.json

@pethers pethers marked this pull request as ready for review May 14, 2026 10:57
Copilot AI review requested due to automatic review settings May 14, 2026 10:57
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a cross-cutting dashboard regression where the static /dashboards/*.html pages were missing the trailing bootstrap that wires up Mermaid initialization, the back-to-top button, and the theme toggle (dark/light mode). It also adds regression tests (unit + Cypress) to prevent silent reintroduction across all dashboard language variants.

Changes:

  • Updates scripts/build-dashboard-pages.py to extract all trailing scripts up to </body> (instead of only the first <script>).
  • Adds scripts/patch-dashboard-bootstrap.py to backfill the bootstrap block into already-committed dashboards/*.html pages (idempotently).
  • Adds structural/unit assertions and Cypress runtime assertions to verify the bootstrap presence and that the theme toggle actually works.

Reviewed changes

Copilot reviewed 131 out of 131 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
scripts/build-dashboard-pages.py Widens TAIL_SCRIPTS_RE to capture all tail scripts (including the inject bootstrap) up to </body>.
scripts/patch-dashboard-bootstrap.py New idempotent patcher to insert the inject bootstrap after the dashboard entry script in committed dashboard pages.
dashboards/*.html (126 files) Adds the inject-IIFE bootstrap block after the main entry script on every dashboard page/language variant.
tests/dashboard-pages.test.js Adds a per-dashboard-file structural regression guard for the bootstrap block.
cypress/support/commands.js Adds cy.expectThemeToggleWorks() helper to assert runtime theme toggling.
cypress/e2e/dashboards-per-chart/_helpers.js Wires the theme-toggle runtime assertion into the per-dashboard suite (non-hub dashboards).

Comment thread cypress/support/commands.js Outdated
Comment on lines +332 to +336
// DOMContentLoaded. The handler sets `aria-pressed` on the button
// during init; use that as the readiness signal.
cy.get('#theme-toggle', { timeout: 15000 })
.should('have.attr', 'aria-pressed')
.and('match', /^(true|false)$/);
Comment on lines +192 to +198
// The bootstrap must be the documented imperative-inject IIFE
// (so Vite's HTML transformer does not try to bundle the
// referenced modules). Anchor on the IIFE entry-point and the
// three inject() calls in that order.
expect(html, `${filename} bootstrap is missing the inject() IIFE wrapper`).toMatch(
/function inject\(src,\s*isModule\)/,
);
@github-actions
Copy link
Copy Markdown
Contributor

🔍 Lighthouse Performance Audit

Category Score Status
Performance 85/100 🟡
Accessibility 95/100 🟢
Best Practices 90/100 🟢
SEO 95/100 🟢

📥 Download full Lighthouse report

Budget Compliance: Performance budgets enforced via budget.json

@github-actions
Copy link
Copy Markdown
Contributor

🔍 Lighthouse Performance Audit

Category Score Status
Performance 85/100 🟡
Accessibility 95/100 🟢
Best Practices 90/100 🟢
SEO 95/100 🟢

📥 Download full Lighthouse report

Budget Compliance: Performance budgets enforced via budget.json

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 132 out of 132 changed files in this pull request and generated 2 comments.

Comment thread tests/dashboard-pages.test.js Outdated
Comment on lines +187 to +191
it('ships /js/theme-toggle.js + /js/back-to-top.js + /js/lib/mermaid-init.mjs bootstrap', () => {
html ||= readPage(filename);
expect(html, `${filename} missing /js/theme-toggle.js bootstrap`).toContain("/js/theme-toggle.js");
expect(html, `${filename} missing /js/back-to-top.js bootstrap`).toContain("/js/back-to-top.js");
expect(html, `${filename} missing /js/lib/mermaid-init.mjs bootstrap`).toContain("/js/lib/mermaid-init.mjs");
Comment thread cypress/support/commands.js Outdated
Comment on lines +335 to +336
.should('have.attr', 'aria-pressed')
.and('match', /^(true|false)$/);
@pethers
Copy link
Copy Markdown
Member

pethers commented May 14, 2026

@copilot apply changes based on the comments in this thread

Co-authored-by: pethers <1726836+pethers@users.noreply.github.com>
@github-actions github-actions Bot added documentation Documentation updates translation Translation updates rtl RTL language support (Arabic, Hebrew) news News articles and content generation labels May 14, 2026
@github-actions
Copy link
Copy Markdown
Contributor

🔍 Lighthouse Performance Audit

Category Score Status
Performance 85/100 🟡
Accessibility 95/100 🟢
Best Practices 90/100 🟢
SEO 95/100 🟢

📥 Download full Lighthouse report

Budget Compliance: Performance budgets enforced via budget.json

Copy link
Copy Markdown
Contributor Author

Copilot AI commented May 14, 2026

@copilot apply changes based on the comments in this thread

Implemented the review-thread fixes in 28a336d:

  • corrected the Cypress theme-toggle readiness assertion to validate aria-pressed from the element value (no subject-chain mismatch), and
  • tightened dashboard-pages bootstrap assertions to be quote-style agnostic and to enforce ordered inject(...) calls.

I also pushed 2b5da54 to clean up unintended generated-file noise so the PR diff remains scoped. Verified with vitest tests/dashboard-pages.test.js and Cypress parties.cy.js (13/13 passing). No UI markup/visual behavior was changed.

@github-actions
Copy link
Copy Markdown
Contributor

🔍 Lighthouse Performance Audit

Category Score Status
Performance 85/100 🟡
Accessibility 95/100 🟢
Best Practices 90/100 🟢
SEO 95/100 🟢

📥 Download full Lighthouse report

Budget Compliance: Performance budgets enforced via budget.json

@pethers pethers requested a review from Copilot May 14, 2026 12:46
@pethers pethers merged commit 25c751e into main May 14, 2026
18 of 19 checks passed
@pethers pethers deleted the copilot/fix-broken-dashboard-pages branch May 14, 2026 12:57
Copilot AI review requested due to automatic review settings May 14, 2026 13:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Documentation updates html-css HTML/CSS changes javascript JavaScript code changes news News articles and content generation refactor Code refactoring rtl RTL language support (Arabic, Hebrew) size-xl Extra large change (> 1000 lines) testing Test coverage translation Translation updates

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants