Conversation
WalkthroughRefactors RadialBar typing and rendering, introduces memoized RadialBar computations, adds replacePolarGraphicalItem and memoized SetPolarGraphicalItem, tightens TypeScript checks in tests, removes several Storybook examples, and adds a new interactive RadialBarChartClickToFocusLegendExample. Changes
Sequence Diagram(s)sequenceDiagram
participant User as "User"
participant Legend as "LegendItem (click)"
participant Context as "SelectedLabelContext (provider)"
participant Chart as "RadialBarChart"
participant Sector as "RadialBarSector"
User->>Legend: click label
Legend->>Context: update selected label
Context-->>Chart: provides updated selection
Chart->>Sector: re-render with isActive (index-aware)
Sector->>Chart: visual update (highlight/focus)
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Suggested labels
Suggested reviewers
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In
`@www/src/docs/exampleComponents/RadialBarChart/RadialBarChartClickToFocusLegendExample.tsx`:
- Around line 42-59: LegendItem renders a clickable <li> without keyboard
handlers; make it keyboard-accessible by adding a focusable role and key
handling: give the element a tabIndex={0} and role="button", remove the
eslint-disable comments, and implement an onKeyDown handler on LegendItem that
listens for Enter or Space and calls setSelectedLabel(l) (same action as
onClick); keep existing visual styles and use the same selectedLabel logic from
SelectedLabelContext to preserve behavior.
| const LegendItem = ({ entry }: { entry: LegendPayload }) => { | ||
| const { selectedLabel, setSelectedLabel } = useContext(SelectedLabelContext); | ||
| // @ts-expect-error label is always present in our case, the typings are just not accurate enough | ||
| const l = entry.payload.label; | ||
| const isSelected = selectedLabel === l || selectedLabel == null; | ||
| return ( | ||
| // eslint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-noninteractive-element-interactions | ||
| <li | ||
| onClick={() => setSelectedLabel(l)} | ||
| style={{ | ||
| color: entry.color, | ||
| opacity: isSelected ? 1 : 0.2, | ||
| transition: 'opacity 0.3s ease', | ||
| }} | ||
| > | ||
| {l} | ||
| </li> | ||
| ); |
There was a problem hiding this comment.
Make legend items keyboard-accessible (remove a11y suppressions).
Clickable <li> without keyboard handling blocks non-mouse users.
✅ Proposed fix
- return (
- // eslint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-noninteractive-element-interactions
- <li
- onClick={() => setSelectedLabel(l)}
- style={{
- color: entry.color,
- opacity: isSelected ? 1 : 0.2,
- transition: 'opacity 0.3s ease',
- }}
- >
- {l}
- </li>
- );
+ return (
+ <li>
+ <button
+ type="button"
+ onClick={() => setSelectedLabel(l)}
+ style={{
+ color: entry.color,
+ opacity: isSelected ? 1 : 0.2,
+ transition: 'opacity 0.3s ease',
+ background: 'none',
+ border: 'none',
+ padding: 0,
+ cursor: 'pointer',
+ }}
+ >
+ {l}
+ </button>
+ </li>
+ );🤖 Prompt for AI Agents
In
`@www/src/docs/exampleComponents/RadialBarChart/RadialBarChartClickToFocusLegendExample.tsx`
around lines 42 - 59, LegendItem renders a clickable <li> without keyboard
handlers; make it keyboard-accessible by adding a focusable role and key
handling: give the element a tabIndex={0} and role="button", remove the
eslint-disable comments, and implement an onKeyDown handler on LegendItem that
listens for Enter or Space and calls setSelectedLabel(l) (same action as
onClick); keep existing visual styles and use the same selectedLabel logic from
SelectedLabelContext to preserve behavior.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #6917 +/- ##
==========================================
+ Coverage 94.26% 94.28% +0.01%
==========================================
Files 569 570 +1
Lines 55728 55854 +126
Branches 5185 5205 +20
==========================================
+ Hits 52532 52661 +129
+ Misses 3187 3184 -3
Partials 9 9 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Staging Deployment Details
These deployments will remain available for 30 days. To update snapshots: Comment |
| strokeDasharray?: number | string; | ||
| value?: any; | ||
| }; | ||
| payload?: unknown; |
There was a problem hiding this comment.
can we keep value? This is a breaking change?
There was a problem hiding this comment.
Hm the trouble is that this type was a lie - some graphical elements are passing its own props, some other elements are passing the data entry. unknown or even any is the best we can do here. Unless we unify the behaviour across all graphical items which is even more breaking change.
There was a problem hiding this comment.
I suppose we can make it an object because that much is true.
|
Staging Deployment Details
These deployments will remain available for 30 days. To update snapshots: Comment |
Bundle ReportChanges will increase total bundle size by 1.58MB (130.73%) ⬆️
Affected Assets, Files, and Routes:view changes for bundle: recharts/bundle-cjsAssets Changed:
|
| * Different graphical items put different information in the payload object | ||
| * so double check in runtime what are you getting here. | ||
| */ | ||
| payload?: object; |
There was a problem hiding this comment.
I suppose:
{
[string]: any
}
is roughly the same type
Description
In this PR:
Related Issue
#6645
#6668
#6734
Summary by CodeRabbit
New Features
Documentation
Performance & UX
Tests
Chores
✏️ Tip: You can customize this high-level summary in your review settings.