Skip to content

feat: add hover explanation for Active learners, fix clipped month label in engagement chart - #3966

Merged
daniellefrappier18 merged 3 commits into
mainfrom
daniellef/add-hover-description-to-analytics
Sep 23, 2026
Merged

daniellefrappier18 merged 3 commits into
mainfrom
daniellef/add-hover-description-to-analytics

Conversation

@daniellefrappier18

@daniellefrappier18 daniellefrappier18 commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

What are the relevant tickets?

N/A — no mit-learn issue tracks this directly.

Description (What does it do?)

Two small, related fixes to the "Monthly engagement" table in the B2B analytics dashboard.

  1. Hover explanation for "Active learners". The column header now shows an info icon; hovering or focusing it explains what counts as active. The copy is sourced from the monthly_active_learners field description added in mitodl/ol-analytics-api#57, itself derived from the backing dbt SQL — so the tooltip stays grounded in the same definition that backs the API's own schema. But, that description only lives in the API's OpenAPI schema today, so this is a hand-copied string with a comment explaining why it can drift and needs a manual update if the backend description ever changes.

  2. Fixed the last month's x-axis label rendering empty. @mui/x-charts caps a point-scale tick's label width at 2 * min(space to its left, space toits right). The last tick sits exactly at the drawing area's edge, so that budget collapsed to 2 * margin.right — at the previous 8px margin, only 16px, too narrow for any 3-letter month abbreviation. The library's own ellipsis logic was silently shortening it down to nothing. Bumped the right margin to 20px.

Screenshots (if appropriate):

  • Desktop screenshots
  • Mobile width screenshots

How can this be tested?

This assumes local dev on the Tilt/k3d stack (~/Desktop/work/ol-infrastructure), not docker compose.

Prerequisite: mitxonline manager access — a mitxonline user with
is_manager=True on some org, so the dashboard route resolves at all.

1. Confirm the analytics-api stub is running. This page's data comes from a local-dev-only stub (the real ol-analytics-api reads dbt-materialized views out of StarRocks, not realistic to run in k3d), not from anything specific you set up in mitxonline — same stub set up for #3958. It lives on
mitodl/ol-infrastructure#5788 (daniellef/analytics-api-stub); check it out and tilt up deploys it automatically.

  1. Enable the b2b-analytics-dashboard PostHog feature flag for your account, sign in at https://learn.mit.dev, and go to /organization//analytics.
  • Verify: the "Monthly engagement" table's "Active learners" header shows an info icon; hovering it (and tabbing to it with the keyboard) shows the explanation text.
  • Verify: the x-axis's last tick reads "Feb", not blank.
  • Verify: nothing else in the chart or table shifted — Sep–Jan labels, gridlines, and the line marks look the same as before.

Additional Context

@github-actions

github-actions Bot commented Sep 21, 2026 •

Copy link
Copy Markdown

OpenAPI Changes

No changes detected

View full changelog

Unexpected changes? Ensure your branch is up-to-date with main (consider rebasing).

@daniellefrappier18
daniellefrappier18 marked this pull request as ready for review September 21, 2026 18:57
@daniellefrappier18
daniellefrappier18 requested a review from a team as a code owner September 21, 2026 18:57
Copilot AI balanced review requested due to automatic review settings September 21, 2026 18:57

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

The explanation is unavailable in the mobile layout, and its tooltip interaction is not exercised by the test.

Get a fresh assessment by requesting another Copilot review.

Review effort: Balanced
Findings: 1 Medium severity · 1 Low severity

Open (2)
What changed in this PR

Adds explanatory help for active learners and prevents the final engagement-chart month label from being clipped.

Changes:

  • Adds an accessible tooltip defining active learners.
  • Increases chart margin to preserve the final x-axis label.
  • Adds tooltip-label coverage.
File Description
EngagementTrendChart.tsx Adds the tooltip and adjusts chart spacing.
charts.test.tsx Tests the active-learner explanation label.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@alexfigtree
alexfigtree self-requested a review September 22, 2026 13:39

@alexfigtree alexfigtree left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Checked off testing boxes - everything looks good on my end.

daniellefrappier18 and others added 2 commits September 23, 2026 09:58
TableHeaderRow (and the hover-definition trigger inside it) is hidden
below the md breakpoint, so the definition was unreachable on
mobile/tablet. Adds one non-repeating copy outside the table for
those widths. Also replaces the aria-label-only test with one that
drives real hover and asserts the rendered tooltip, since the old
test passed even with Tooltip removed entirely.

Addresses Copilot review feedback on PR #3966.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@daniellefrappier18
daniellefrappier18 merged commit 35a5aba into main Sep 23, 2026
14 checks passed
@daniellefrappier18
daniellefrappier18 deleted the daniellef/add-hover-description-to-analytics branch September 23, 2026 17:33
This was referenced Sep 23, 2026
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.

3 participants