Skip to content

feat(scoreboard): contextual top-10 chart — labels + detail tooltip - #53

Merged
tbcsec merged 1 commit into
mainfrom
feat/scoreboard-chart-context
Jul 26, 2026
Merged

feat(scoreboard): contextual top-10 chart — labels + detail tooltip#53
tbcsec merged 1 commit into
mainfrom
feat/scoreboard-chart-context

Conversation

@tbcsec

@tbcsec tbcsec commented Jul 26, 2026

Copy link
Copy Markdown
Owner

Fixes #52

What

The top-10 bars carried only a rank number — no context without scanning the table below. Each column now explains itself three ways:

  • At a glance: points figure above every bar; rank stacked over a truncated name below it (stacked rather than inline per owner feedback mid-build — a tenth-width column is too cramped for both on one line).
  • On hover / focus: a detail tooltip — medal RankBadge, full name, points, last solve, division when brackets are in play, and the "you"/"your team" marker.
  • To a screen reader: an aria-label per column carrying the same facts, so parity doesn't depend on the visual layer.

Design notes

  • React-state reveal, not a CSS :hover/:focus trick. Keyboard Tab and mobile tap (tap = focus on a button) open the tooltip through the same onFocus/onMouseEnter path, one at a time, and the tests assert the reveal itself rather than trusting a pseudo-class. (I built the CSS-only version first and found it unverifiable — neither RTL nor the preview browser can prove a :focus reveal — so I switched to state on purpose.)
  • Edge anchoring: the first/last two columns pin their tooltip to the near edge instead of centring, so nothing clips outside the card — measured: first tooltip left 305px vs card left 281px.
  • Headroom: bars scale to 86% so the tallest bar's points label always fits.
  • Extractions per §14: chart → components/scoreboard/top-chart.tsx, RankBadgerank-badge.tsx (now shared by the table and the tooltip). Hand-rolled, §9 tokens only, no tooltip library.

Tests & verification

  • +7 RTL tests: aria-label facts, mode-worded "you/your team", focus reveal + blur hide, hover one-at-a-time, tooltip content, at-a-glance labels, bar scaling (86% leader / 0% zero-points). Suite 130 passed; tsc + eslint clean; npm run build exit 0.
  • Browser (demo board, 10 live entries): tooltip verified open via the React path with correct content; layout screenshotted on a dark and light palette (medal disc + popover legible on both); no console errors; live WS updates re-derive the chart unchanged.

Frontend-only — no backend, no migration.

🤖 Generated with Claude Code

The top-10 bars said nothing without scanning the table below (#52).
Each column now carries its context three ways: at a glance (points
above the bar, rank stacked over a truncated name below it — stacked
rather than inline, owner call, a tenth-width column is too cramped for
both), on hover/focus (a detail tooltip with medal rank, full name,
points, last solve, division, and the you/your-team marker), and to a
screen reader (an aria-label on the column carrying the same facts, so
parity doesn't depend on the visual layer).

The tooltip reveal is React state driven off focus/hover — not a CSS
:hover/:focus trick — so keyboard Tab and mobile tap (tap = focus on a
button) open it identically and tests assert the reveal rather than
trusting a pseudo-class. One open at a time; edge columns anchor their
tooltip to the nearest edge so the first/last can't clip outside the
card; bars keep 14% headroom so the tallest bar's points label fits.

Chart extracted from the page into components/scoreboard/top-chart.tsx
(§14), RankBadge into rank-badge.tsx so the table and the tooltip share
the medal rendering. Hand-rolled, tokens only — no tooltip library.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@tbcsec
tbcsec merged commit 96e1eb4 into main Jul 26, 2026
4 checks passed
@tbcsec
tbcsec deleted the feat/scoreboard-chart-context branch July 26, 2026 11:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: improved scoreboard graph context

1 participant