Skip to content

feat(charts): add interactive legend focus - #148

Merged
robinvrd merged 12 commits into
mainfrom
robin/chart-legend-focus
Nov 12, 2026
Merged

robinvrd merged 12 commits into
mainfrom
robin/chart-legend-focus

Conversation

@robinvrd

Copy link
Copy Markdown
Contributor

What this brings

  • Hover a legend item to emphasize its series and dim the others.
  • Click to focus one series; click other items to add them. Showing every series exits focus automatically.
  • Rescale automatic value axes to the visible series while preserving explicit ranges, bar zero baselines, and category positions.
  • Keep crowded legends usable with overflow, hide excluded series dots, and prevent stray tooltips on legend clicks.

Checks

  • bun run check:static
  • bun run test --maxWorkers=6 — 1,203 tests passed
  • bun run check:package
  • bun run check:starter

@robinvrd
robinvrd requested a review from leonkenneth November 12, 2026 11:39

@albert20260301 albert20260301 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Native series sharing a primitive dataKey cannot be focused unless the caller supplies explicit IDs. I reproduced this on 50c0f31 in Chromium with two native Recharts <Line dataKey="value" name="Alpha|Beta" /> children inside ComposedChart: clicking Alpha leaves two curves visible and its aria-pressed immediately returns to false. Giving those same lines distinct IDs makes the click select one curve with aria-pressed="true".

applyNativeLegendInteraction only generates an ID for non-primitive data keys, while createLegendItemKeys disambiguates duplicate primitive keys with object-identity suffixes. The focus selection therefore does not match either series key, and reconciliation resets it. Please use the same unique series identity on both sides for this supported native composition, and cover duplicate primitive data keys without explicit IDs in the browser tests.

Local static checks pass. The new single-key accessor case does not cover this collision.

@albert20260301

Copy link
Copy Markdown

The duplicate-key fix in e32c262 passes the independent Chromium probe: without explicit IDs, clicking Alpha now leaves one curve and aria-pressed="true". The added regression and both local legend/inspection suites also pass.

Approval is still waiting on required CI: Tests (4/4) fails Hover bars leave restores complete focus readings at apps-chart-inspection.test.ts:624 because the tooltip remains visible after moving the pointer out. I did not reproduce that failure in the local two-file run, so I cannot yet identify it as a code regression or runner-sensitive failure. The reported identity issue is resolved; the required inspection gate still needs to be green.

@albert20260301 albert20260301 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The duplicate-key identity fix and its browser regression are verified on e32c262. The independent Chromium probe now focuses a native series without explicit IDs; both local legend/inspection suites pass (50 tests). The required inspection retry and aggregate gate are now green on this unchanged head.

The earlier full local static, 1,203-test, package-consumer and starter checks passed; the subsequent identity-fix delta was reviewed and built separately. The requested changes are resolved.

@robinvrd
robinvrd merged commit a1f40a5 into main Nov 12, 2026
20 of 22 checks passed
@robinvrd
robinvrd deleted the robin/chart-legend-focus branch November 12, 2026 13:21
robinvrd pushed a commit that referenced this pull request Nov 12, 2026
🤖 I have created a release *beep* *boop*
---


##
[0.77.0](v0.76.0...v0.77.0)
(2026-11-12)


### ⚠ BREAKING CHANGES

* give each widget its own query, loaded near the viewport
([#145](#145))

### Features

* **charts:** add interactive legend focus
([#148](#148))
([a1f40a5](a1f40a5))
* give each widget its own query, loaded near the viewport
([#145](#145))
([4f9fcd5](4f9fcd5))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

---------

Co-authored-by: altertable-release[bot] <345426372+altertable-release[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@albert20260301

Copy link
Copy Markdown

Available in v0.77.0. I verified all seven npm archives against their registry SHA-512 values and fresh archives built from the release commit; every packaged file matches. A clean installed-package Chromium smoke test also confirms that native series sharing a data key focus correctly without explicit IDs.

This release also includes the breaking per-widget query/loading migration; see the view guide at the release tag. Existing consumer bundles still need their own migration, rebuild and deployment.

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