feat(donut-s2): Hover - segment hover fade, direct-label color switch, and legend bidirectional highlight - #895
Open
madelineluke wants to merge 2 commits into
Conversation
madelineluke
marked this pull request as draft
August 27, 2026 15:44
madelineluke
force-pushed
the
feat/donut-hover-segment-fade-label-color-switch
branch
from
August 27, 2026 20:23
9e2fc9a to
ecdee5c
Compare
madelineluke
changed the base branch from
main
to
feat/donut-direct-labels-ring-gap-sizing-anchor
August 27, 2026 20:23
madelineluke
force-pushed
the
feat/donut-hover-segment-fade-label-color-switch
branch
from
August 27, 2026 20:55
ecdee5c to
e25276c
Compare
madelineluke
marked this pull request as ready for review
August 27, 2026 21:15
madelineluke
force-pushed
the
feat/donut-hover-segment-fade-label-color-switch
branch
from
August 27, 2026 21:31
e25276c to
6c92d33
Compare
…gend bidirectional highlight - Extend isInteractive so a donut with a SegmentLabel showing value/percent is hover-interactive on its own, with no popover/inspect required - verified no other mark type declares a segmentLabels field, so this is a no-op everywhere else. - Add a SERIES_ID data transform (reusing the existing generic getSeriesIdTransform helper) whenever a donut is interactive or paired with a highlighting Legend - needed for both hover directions with a Legend to actually match rows, since donut's data never had this field before, unlike Line/Bar. - Both SegmentLabel text marks now fade via the same getMarkOpacity mechanism the arc mark already used, and the value line switches to the hovered segment's own categorical color (name line stays gray-700), matching the Figma reference. - Add legendHighlightSignals to DonutSpecOptions and consume it on the arc mark, fading non-matching segments when a paired Legend entry is hovered - the reverse direction of the arc's own hover highlighting the legend (which already worked generically via userMeta.interactiveMarks). - Add Donut/Features/Hover stories: a bare SegmentLabel (no popover) case, and a Legend-paired case demonstrating both hover directions. Verified live in Storybook via precise on-pixel hover simulation, not just unit tests: hovering an arc fades siblings and highlights the matching legend entry; hovering a legend entry fades non-matching arcs. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
getSegmentLabelValueFill only checked the arc's own HOVERED_ITEM signal, so hovering a paired Legend entry faded the arc (via legendHighlightSignals) without switching the matching segment's label color, unlike direct arc hover.
madelineluke
force-pushed
the
feat/donut-hover-segment-fade-label-color-switch
branch
from
August 27, 2026 21:43
6c92d33 to
b836f13
Compare
|
|
🎨 Storybook -> https://opensource.adobe.com/react-spectrum-charts/PR-895 🎨 S2 Storybook -> https://opensource.adobe.com/react-spectrum-charts/PR-895-s2 📚 Docs -> https://opensource.adobe.com/react-spectrum-charts/PR-895-docs/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Description
Implements the
donut-hoverspec: hovering a donut segment fades its siblings, switches the hovered segment's direct-label value to its own categorical color, and syncs highlight state bidirectionally with a paired<Legend>.isInteractiveso a donut with aSegmentLabelshowingvalue/percentis hover-interactive on its own, with no popover/inspect required. Verified no other mark type declares asegmentLabelsfield, so this is a no-op everywhere else.SERIES_IDdata transform (reusing the existing genericgetSeriesIdTransformhelper) whenever a donut is interactive or paired with a highlightingLegend- needed for both hover directions with a Legend to actually match rows, since donut's data never had this field before, unlike Line/Bar.SegmentLabeltext marks now fade via the samegetMarkOpacitymechanism the arc mark already used, and the value line switches to the hovered segment's own categorical color (the name line stays gray-700, unchanged) - matching the Figma reference exactly.legendHighlightSignalstoDonutSpecOptionsand consumes it on the arc mark, fading non-matching segments when a paired Legend entry is hovered - the reverse direction of the arc's own hover already highlighting the legend generically viauserMeta.interactiveMarks.Donut/Features/Hoverstories: a bareSegmentLabelcase (no popover) and aLegend-paired case demonstrating both hover directions.Related Issue
planning/specs/donut/donut-hover.json(approved)Motivation and Context
Today a donut with only a direct label configured (no popover/inspect) produces no hover feedback at all, and even where hover exists (via a popover), the direct label's value never reflects which segment is hovered and never fades with its de-emphasized arc. Separately, a donut paired with a
<Legend>never highlighted in either direction, unlike Line/Bar, because the genericlegendHighlightSignalsmechanism was already being spread into donut's options but silently dropped (untyped, unconsumed), and donut's data was missing theSERIES_IDfield the legend's generic hover matching relies on.How Has This Been Tested?
markUtils.test.ts,donutSpecBuilder.test.ts,donutUtils.test.ts, and a newhover behaviorblock insegmentLabelUtils.test.tsx.vega-spec-builder-s2/react-spectrum-charts-s2test suite passes (131 suites, 2120 tests).yarn lintandyarn tsc --noEmitare clean (no new errors; two pre-existing unrelated failures confirmed present onmaintoo).Screenshots (if appropriate):
See the
SimpleDirectLabelandWithLegendstories underReact Spectrum Charts 2/Donut/Features/Hoverin Storybook.Types of changes
Checklist: