Skip to content

fix(report): make filter buttons legible and open advisories in a new tab (2.3.1) - #10

Merged
Ali Bahaloo (alibahaloo) merged 2 commits into
mainfrom
fix/html-report-ui
Jul 25, 2026
Merged

fix(report): make filter buttons legible and open advisories in a new tab (2.3.1)#10
Ali Bahaloo (alibahaloo) merged 2 commits into
mainfrom
fix/html-report-ui

Conversation

@alibahaloo

@alibahaloo Ali Bahaloo (alibahaloo) commented Jul 25, 2026

Copy link
Copy Markdown
Collaborator

Two defects found while live-testing the 2.3.0 HTML report. Both are in generated output only — no interface change — so this also bumps VERSION to 2.3.1 per the release runbook.

1. Filter button labels were invisible until clicked

Reported symptom: the Impacted / Needs review / Not impacted buttons appeared as blank white rectangles, only becoming readable once pressed.

Root cause was a mistake in our stylesheet, not a browser quirk. The report declared:

:root { color-scheme: light dark; }

…while the page hardcodes light body colours (color: #1b1b1b; background: #f7f7f8) and implements no dark theme at all. That declaration tells the browser the page supports dark mode, so it styled form controls for dark mode — white text — against the #fff background set on .controls button. That rule set a background but never a color, and font: inherit does not carry colour, so nothing overrode the user agent. Only the pressed button escaped, because it explicitly sets color: #fff on a dark background.

Reproduced before changing anything, under prefers-color-scheme: dark:

Button color background
All (3) (pressed) rgb(255,255,255) rgb(31,78,120)
Impacted (1) rgb(255,255,255) rgb(255,255,255)
Needs review (1) rgb(255,255,255) rgb(255,255,255)
Not impacted (1) rgb(255,255,255) rgb(255,255,255)

Fixed at both levels: color-scheme: light, so the report stops advertising support it does not have; and an explicit color on the buttons, so they are correct regardless of user agent or scheme. The explicit colour is the real fix — it does not depend on colour-scheme behaviour.

Verified under dark mode after the fix: unpressed buttons compute to 17.2:1 contrast, the pressed button to 8.7:1. Both above WCAG AAA (7:1).

Also adds :hover and :focus-visible states. Overriding the user-agent button style had removed both the hover feedback (a button with none reads as broken) and the focus ring, leaving keyboard users with no visible focus indicator.

2. Advisory links replaced the report in the same tab

target="_blank" was missing. A reader working through a filtered list lost their filter and scroll position on every advisory they opened — which is most of the point of the report. rel="noreferrer noopener" was already present and is the required companion, so the opened page gets no handle back to the report.

Regression tests are confirmed non-vacuous

Rather than only checking they pass after the fix, I reintroduced both defects in memory and confirmed 5 of 8 new tests fail:

  • the CSS tests parse the .controls button declaration block and assert an explicit color distinct from its background, so a future edit that drops it fails instead of shipping invisible text again;
  • the link tests assert every anchor carries both target and rel, and that an advisory with no URL renders no anchor at all.

Tests: 236 → 244, green under CI's unittest discover -s tests.

Constitution compliance (v2.2.0)

  • I. Standard-Library-First — PASS. CSS and HTML string changes only; no dependency added.
  • II. Cross-Platform Parity — PASS. The fix removes reliance on user-agent colour decisions, so rendering is now less platform-dependent than before.
  • III. CLI-First — N/A. No CLI surface, flag, or exit code changes.
  • IV. Conservative & Traceable — N/A. No verdict logic touched; matching.py and psirt.py are untouched.
  • V. Secrets Hygiene — PASS. No credential path involved; the existing report hygiene tests still pass.
  • Quality Gates — PASS. Both fixes carry tests proven to fail against the pre-fix code. No README or docs/index.html change needed — neither documents report styling.

Note for after merge

Merging makes main 2.3.1. Users only receive it once the tag is pushed and the Release workflow publishes it, since caia --update discovers releases via /releases/latest.

🤖 Generated with Claude Code

Ali Bahaloo (alibahaloo) and others added 2 commits July 25, 2026 10:42
… tab

Two defects found during live testing of the 2.3.0 HTML report.

1. Filter button labels were invisible until clicked.

   Root cause was a mistake in the stylesheet, not the browser: the
   report declared `:root { color-scheme: light dark; }` while the page
   hardcodes light body colours and implements no dark theme. That
   declaration tells the browser the page supports dark mode, so it
   styled form controls for dark mode — white text — against the `#fff`
   background set here. `.controls button` set a background but no
   `color`, and `font: inherit` does not carry colour, so nothing
   overrode the user agent. Only the pressed button was visible, because
   it explicitly sets `color: #fff` on a dark background.

   Reproduced with prefers-color-scheme: dark, where the unpressed
   buttons computed to rgb(255,255,255) on rgb(255,255,255).

   Fixed at both levels: `color-scheme: light` so the report stops
   advertising support it does not have, and an explicit `color` on the
   buttons so they are correct regardless of user agent or scheme. The
   explicit colour is the real fix; it does not depend on colour-scheme
   behaviour. Verified under dark mode: unpressed buttons now compute to
   17.2:1 contrast and the pressed button to 8.7:1, both above WCAG AAA.
   Also adds hover and focus-visible states — a button with no hover
   feedback reads as broken, and the focus ring restores keyboard
   affordance that came from the user-agent style being overridden.

2. Advisory links replaced the report in the same tab.

   `target="_blank"` was missing. A reader working through a filtered
   list lost their filter and scroll position on every advisory they
   opened. `rel="noreferrer noopener"` was already present and is the
   required companion, so it now denies the opened page a handle back to
   the report.

Both are covered by regression tests that were confirmed to fail against
the pre-fix code (5 of 8 fail when the defects are reintroduced), rather
than only passing after the fix: the CSS tests parse the `.controls
button` declaration block and assert an explicit colour distinct from
its background, and the link tests assert every anchor carries both
target and rel.

Tests: 236 -> 244.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Patch bump for the HTML report fixes in f119ff6 (invisible filter button
labels; advisory links opening in the same tab). Behaviour-only fixes to
generated output, no API or interface change, so PATCH per semver.

Per the release runbook the bump lands in this PR so `main` always
reflects the latest released version; the tag is pushed after merge.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@alibahaloo Ali Bahaloo (alibahaloo) added the enhancement New feature or request label Jul 25, 2026
@alibahaloo
Ali Bahaloo (alibahaloo) merged commit 544629c into main Jul 25, 2026
2 checks passed
@alibahaloo
Ali Bahaloo (alibahaloo) deleted the fix/html-report-ui branch July 25, 2026 19:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant