Skip to content

Fixing visual regressions#6553

Merged
PavelVanecek merged 7 commits intomainfrom
zindex-default-activebar
Nov 3, 2025
Merged

Fixing visual regressions#6553
PavelVanecek merged 7 commits intomainfrom
zindex-default-activebar

Conversation

@PavelVanecek
Copy link
Collaborator

@PavelVanecek PavelVanecek commented Nov 3, 2025

Description

Fixing stories that I broke: https://www.chromatic.com/build?appId=63da8268a0da9970db6992aa&number=3070

Couple of things:

  1. I have reshuffled the zIndex defaults so that the labels are always on top, and RadialBar cursor renders on top as well.
  2. Added explicit zindex to the custom SVG component in DraggablePie story - the defaults moved it behind the Pie areas, however in this particular chart I want it on top, that's what the ZIndexLayer is for
  3. I have reverted the Pie props move - the spread of unknown obliterates any hope that we can have of strong typing, unfortunately couple of our stories rely on it - and I expect that our users do too. I will leave this change for 4.0.

Motivation and Context

Unblocking 3.4 release

How Has This Been Tested?

This is fixing failed storybook diff.

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • I have added a storybook story or VR test, or extended an existing story or VR test to show my changes

Summary by CodeRabbit

  • Improvements

    • Refined z-index layering for cursor, points and draggable elements to improve visual stacking and interaction feedback.
    • Axis rendering reorganized so tick lines and tick labels are grouped separately, improving label layout and styling consistency.
  • Updates

    • Adjusted default layering priorities for chart elements for more predictable overlap.
    • Pie slices now respect per-slice overrides, allowing cell-level props to override computed values.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 3, 2025

Walkthrough

These changes refactor z-index keys and usage, introduce ZIndexLayer wrapping for cursor and several symbols, add a RenderCursor helper with context-aware preferred z-indexing, change Pie sector prop spread order so cell props can override computed values, and propagate axis type/ref changes through Cartesian axis/tick rendering with corresponding test updates.

Changes

Cohort / File(s) Summary
Z-index core
src/zindex/DefaultZIndexes.tsx, test/zindex/zIndexSelectors.spec.ts
Rename and reassign default z-index keys (cursorcursorRectangle: 200, labelactiveBar: 1000, activeBarcursorLine: 1100), bump activeDot to 1200, add label: 2000; update tests to expect the new z-index set and order.
Cursor rendering & z-index integration
src/component/Cursor.tsx
Add RenderCursor helper to clone/instantiate cursor element or component; compute preferredZIndex from chart context/type; wrap rendered cursor with ZIndexLayer using props.zIndex ?? preferredZIndex; remove outer ZIndexLayer from Cursor wrapper and pass through layout/offset props.
Pie sector prop merge ordering
src/polar/Pie.tsx
Move entryWithCellInfo spread to after computed fields in computePieSectors, allowing cell-level properties to overwrite previously computed percent/angles/related fields.
ZIndexLayer adoption in components & examples
src/cartesian/Scatter.tsx, storybook/stories/Examples/Pie/DraggablePie.stories.tsx
Wrap scatter symbols and draggable example points with ZIndexLayer; active scatter uses DefaultZIndexes.activeDot; add cursor: grab style to draggable circle.
Cartesian axis & ticks refactor
src/cartesian/CartesianAxis.tsx, src/cartesian/XAxis.tsx, src/cartesian/YAxis.tsx
Add axisType to CartesianAxisProps and TicksProps; convert Ticks to a forwardRef component; separate tick lines and labels into distinct layers/groups with axis-type class names; pass axisType down from X/Y axis components.
Tests & helpers updated for new DOM structure
test/cartesian/*, test/helper/expectAxisTicks.ts, test/state/selectors/selectDisplayedData.spec.ts, test/chart/ScatterChart.spec.tsx
Update selectors and expectations to the new tick-labels/tick-lines DOM structure and to ZIndex-driven changes; adjust minor test accesses and event targets to match refactored rendering.

Sequence Diagram(s)

sequenceDiagram
    participant Chart
    participant CursorInternal
    participant RenderCursor
    participant ZIndexLayer
    participant DefaultZIndexes

    Chart->>CursorInternal: render with props & context
    CursorInternal->>DefaultZIndexes: determine preferredZIndex (chart type)
    CursorInternal->>ZIndexLayer: wrap cursor (zIndex = props.zIndex ?? preferredZIndex)
    ZIndexLayer->>RenderCursor: request cursor render
    RenderCursor->>RenderCursor: clone element or instantiate component with props
    RenderCursor-->>ZIndexLayer: rendered node
    ZIndexLayer-->>Chart: layered cursor output
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~40–60 minutes

  • Multiple cross-cutting changes: z-index renames touch central defaults and tests.
  • Cursor logic introduces new rendering helper + context-based z-index decisions — review for correctness across chart types.
  • CartesianAxis refactor (forwardRef, axisType, separate layers) is significant and affects many tests; needs careful DOM/behavior verification.
  • Pay extra attention to:
    • src/component/Cursor.tsx preferredZIndex computation and ZIndexLayer usage.
    • src/cartesian/CartesianAxis.tsx Ticks forwardRef and class/name changes.
    • Tests updated for DOM structure: ensure no missing selectors or regressions.

Possibly related PRs

Suggested labels

enhancement

Suggested reviewers

  • ckifer

Pre-merge checks and finishing touches

❌ Failed checks (1 inconclusive)
Check name Status Explanation Resolution
Title check ❓ Inconclusive The pull request title 'Fixing visual regressions' is very generic and uses a broad term ('visual regressions') without specifying what aspects of the UI are being fixed. While the title is related to the changeset (which does address visual issues), it lacks the specificity and clarity needed for a developer scanning the git history to quickly understand the primary changes. The title does not convey that the fix involves zIndex reorganization, cursor rendering order, and label stacking. Consider updating the title to be more specific about the main technical changes, such as 'Reorganize zIndex defaults to fix label and cursor rendering order' or 'Fix visual stacking by reshuffling zIndex values for labels and cursors'. This would provide clearer context for future reference while remaining concise.
✅ Passed checks (1 passed)
Check name Status Explanation
Description check ✅ Passed The pull request description is mostly complete and addresses the key sections of the template. It clearly describes what was changed (zIndex reshuffling, explicit zIndex for DraggablePie story, and reverting Pie props changes), provides motivation (unblocking 3.4 release), explains testing approach (Storybook diffs), and correctly identifies the change type as a bug fix. However, the description lacks detail in a few areas: the 'Related Issue' section only contains an implicit link in a comment rather than a structured reference, and the 'How Has This Been Tested' section is somewhat brief without comprehensive details on testing scope.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch zindex-default-activebar

Comment @coderabbitai help to get the list of available commands and usage tips.

@codecov
Copy link

codecov bot commented Nov 3, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.27%. Comparing base (e0e64f5) to head (d293a68).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #6553   +/-   ##
=======================================
  Coverage   91.27%   91.27%           
=======================================
  Files         489      489           
  Lines       40848    40877   +29     
  Branches     4570     4574    +4     
=======================================
+ Hits        37282    37311   +29     
  Misses       3550     3550           
  Partials       16       16           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@codecov
Copy link

codecov bot commented Nov 3, 2025

Bundle Report

Changes will increase total bundle size by 6.18kB (0.24%) ⬆️. This is within the configured threshold ✅

Detailed changes
Bundle name Size Change
recharts/bundle-cjs 1.12MB 2.72kB (0.24%) ⬆️
recharts/bundle-es6 964.89kB 2.59kB (0.27%) ⬆️
recharts/bundle-umd 508.15kB 865 bytes (0.17%) ⬆️

Affected Assets, Files, and Routes:

view changes for bundle: recharts/bundle-cjs

Assets Changed:

Asset Name Size Change Total Size Change (%)
cartesian/Scatter.js 440 bytes 23.72kB 1.89%
cartesian/CartesianAxis.js 1.0kB 17.48kB 6.07% ⚠️
cartesian/YAxis.js 24 bytes 9.21kB 0.26%
cartesian/XAxis.js 24 bytes 7.71kB 0.31%
component/Cursor.js 421 bytes 7.13kB 6.28% ⚠️
zindex/DefaultZIndexes.js 812 bytes 2.37kB 52.29% ⚠️
view changes for bundle: recharts/bundle-es6

Assets Changed:

Asset Name Size Change Total Size Change (%)
cartesian/Scatter.js 410 bytes 22.16kB 1.89%
cartesian/CartesianAxis.js 951 bytes 16.19kB 6.24% ⚠️
cartesian/YAxis.js 24 bytes 7.94kB 0.3%
cartesian/XAxis.js 24 bytes 6.52kB 0.37%
component/Cursor.js 370 bytes 6.07kB 6.5% ⚠️
zindex/DefaultZIndexes.js 812 bytes 2.23kB 57.18% ⚠️
view changes for bundle: recharts/bundle-umd

Assets Changed:

Asset Name Size Change Total Size Change (%)
Recharts.js 865 bytes 508.15kB 0.17%

@PavelVanecek
Copy link
Collaborator Author

image

I think it's better this way. Labels are more important than dots, and people who want both to be visible have choices:

  1. move label to new position
  2. enlarge the active dot
  3. update zIndex

/update-snapshots

@PavelVanecek
Copy link
Collaborator Author

PavelVanecek commented Nov 3, 2025

Hm from the storybook diff:

  • axis tick labels do not have zIndex applied, needs fix
  • active scatter points have same zIndex as inactive points

@github-actions
Copy link
Contributor

github-actions bot commented Nov 3, 2025

Visual Regression tests failed.


To update snapshots: Comment /update-snapshots on this PR to automatically update the baseline screenshots.

@github-actions
Copy link
Contributor

github-actions bot commented Nov 3, 2025

✅ Visual regression snapshots have been updated and committed to this PR.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
test/cartesian/XAxis.spec.tsx (1)

143-144: Consider querying within the tick-labels container for consistency.

While the current approach using getElementsByClassName will work, it differs from the pattern used elsewhere in this file (lines 769, 1261, 3188, 3264, 4174) where queries are explicitly scoped to the .recharts-xAxis-tick-labels container. For consistency and to make the test more robust:

-  const ticksGroup = container.getElementsByClassName('recharts-cartesian-axis-tick-label');
-  expect(ticksGroup).toHaveLength(2);
+  const tickLabels = container.querySelectorAll('.recharts-xAxis-tick-labels .recharts-cartesian-axis-tick-label');
+  expect(tickLabels).toHaveLength(2);

-  const firstTick = ticksGroup[0];
+  const firstTick = tickLabels[0];
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 468ad4b and d293a68.

⛔ Files ignored due to path filters (6)
  • test-vr/__snapshots__/tests/www/BarChartApiExamples.spec-vr.tsx-snapshots/BarChartWithMultiXAxis-1-chromium-linux.png is excluded by !**/*.png
  • test-vr/__snapshots__/tests/www/BarChartApiExamples.spec-vr.tsx-snapshots/BarChartWithMultiXAxis-1-firefox-linux.png is excluded by !**/*.png
  • test-vr/__snapshots__/tests/www/BarChartApiExamples.spec-vr.tsx-snapshots/BarChartWithMultiXAxis-1-webkit-linux.png is excluded by !**/*.png
  • test-vr/__snapshots__/tests/zIndex.spec-vr.tsx-snapshots/bar-and-line-without-z-index-1-chromium-linux.png is excluded by !**/*.png
  • test-vr/__snapshots__/tests/zIndex.spec-vr.tsx-snapshots/bar-and-line-without-z-index-1-firefox-linux.png is excluded by !**/*.png
  • test-vr/__snapshots__/tests/zIndex.spec-vr.tsx-snapshots/bar-and-line-without-z-index-1-webkit-linux.png is excluded by !**/*.png
📒 Files selected for processing (12)
  • src/cartesian/CartesianAxis.tsx (9 hunks)
  • src/cartesian/Scatter.tsx (1 hunks)
  • src/cartesian/XAxis.tsx (1 hunks)
  • src/cartesian/YAxis.tsx (1 hunks)
  • test/cartesian/ReferenceLine/ReferenceLine.spec.tsx (1 hunks)
  • test/cartesian/XAxis.spec.tsx (6 hunks)
  • test/cartesian/XAxis.tickFormatter.spec.tsx (0 hunks)
  • test/cartesian/YAxis/YAxis.spec.tsx (3 hunks)
  • test/cartesian/YAxis/YAxis.tickFormatter.spec.tsx (0 hunks)
  • test/chart/ScatterChart.spec.tsx (1 hunks)
  • test/helper/expectAxisTicks.ts (2 hunks)
  • test/state/selectors/selectDisplayedData.spec.tsx (2 hunks)
💤 Files with no reviewable changes (2)
  • test/cartesian/YAxis/YAxis.tickFormatter.spec.tsx
  • test/cartesian/XAxis.tickFormatter.spec.tsx
🧰 Additional context used
📓 Path-based instructions (2)
{test,www/test}/**

📄 CodeRabbit inference engine (DEVELOPING.md)

Place unit tests in the test directory; some tests may also live in www/test

Files:

  • test/helper/expectAxisTicks.ts
  • test/cartesian/ReferenceLine/ReferenceLine.spec.tsx
  • test/state/selectors/selectDisplayedData.spec.tsx
  • test/chart/ScatterChart.spec.tsx
  • test/cartesian/XAxis.spec.tsx
  • test/cartesian/YAxis/YAxis.spec.tsx
src/**/*.{js,jsx,ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Do not hardcode any user-facing strings or formatting choices in the library code; leave internationalization to library users

Files:

  • src/cartesian/Scatter.tsx
  • src/cartesian/XAxis.tsx
  • src/cartesian/CartesianAxis.tsx
  • src/cartesian/YAxis.tsx
🧠 Learnings (6)
📚 Learning: 2025-10-25T07:35:46.188Z
Learnt from: CR
Repo: recharts/recharts PR: 0
File: test/README.md:0-0
Timestamp: 2025-10-25T07:35:46.188Z
Learning: Applies to test/**/*.test.{ts,tsx} : Mock getBoundingClientRect using test/helper/MockGetBoundingClientRect.ts when rendering Recharts components (e.g., Tooltip, Legend, charts)

Applied to files:

  • test/helper/expectAxisTicks.ts
  • test/cartesian/ReferenceLine/ReferenceLine.spec.tsx
  • test/state/selectors/selectDisplayedData.spec.tsx
  • test/chart/ScatterChart.spec.tsx
  • test/cartesian/XAxis.spec.tsx
  • test/cartesian/YAxis/YAxis.spec.tsx
📚 Learning: 2025-10-25T07:35:46.188Z
Learnt from: CR
Repo: recharts/recharts PR: 0
File: test/README.md:0-0
Timestamp: 2025-10-25T07:35:46.188Z
Learning: Applies to test/**/*.test.{ts,tsx} : When testing selectors, verify render counts using the spy and rerenderSameComponent from createSelectorTestCase

Applied to files:

  • test/helper/expectAxisTicks.ts
  • test/cartesian/ReferenceLine/ReferenceLine.spec.tsx
  • test/state/selectors/selectDisplayedData.spec.tsx
  • test/chart/ScatterChart.spec.tsx
  • test/cartesian/XAxis.spec.tsx
  • test/cartesian/YAxis/YAxis.spec.tsx
📚 Learning: 2025-10-25T07:35:46.188Z
Learnt from: CR
Repo: recharts/recharts PR: 0
File: test/README.md:0-0
Timestamp: 2025-10-25T07:35:46.188Z
Learning: Applies to test/**/*.test.{ts,tsx} : Use expectLastCalledWith instead of toHaveBeenLastCalledWith for typed last-call assertions

Applied to files:

  • test/helper/expectAxisTicks.ts
  • test/state/selectors/selectDisplayedData.spec.tsx
  • test/cartesian/XAxis.spec.tsx
  • test/cartesian/YAxis/YAxis.spec.tsx
📚 Learning: 2025-10-25T07:35:46.188Z
Learnt from: CR
Repo: recharts/recharts PR: 0
File: test/README.md:0-0
Timestamp: 2025-10-25T07:35:46.188Z
Learning: Applies to test/**/*.test.{ts,tsx} : Prefer using the createSelectorTestCase helper when writing or modifying tests

Applied to files:

  • test/helper/expectAxisTicks.ts
  • test/state/selectors/selectDisplayedData.spec.tsx
  • test/chart/ScatterChart.spec.tsx
  • test/cartesian/XAxis.spec.tsx
  • test/cartesian/YAxis/YAxis.spec.tsx
📚 Learning: 2025-10-25T07:36:02.229Z
Learnt from: CR
Repo: recharts/recharts PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-10-25T07:36:02.229Z
Learning: Recharts aims for simple, declarative, and composable charts; prioritize consistency, usability, performance, and accessibility

Applied to files:

  • test/state/selectors/selectDisplayedData.spec.tsx
  • test/cartesian/YAxis/YAxis.spec.tsx
📚 Learning: 2025-10-25T07:35:46.188Z
Learnt from: CR
Repo: recharts/recharts PR: 0
File: test/README.md:0-0
Timestamp: 2025-10-25T07:35:46.188Z
Learning: Applies to test/**/*.test.{ts,tsx} : In tests not using createSelectorTestCase, advance timers after renders with vi.runOnlyPendingTimers()

Applied to files:

  • test/cartesian/XAxis.spec.tsx
🧬 Code graph analysis (4)
src/cartesian/Scatter.tsx (5)
src/zindex/ZIndexLayer.tsx (1)
  • ZIndexLayer (49-108)
src/zindex/DefaultZIndexes.tsx (1)
  • DefaultZIndexes (4-81)
src/container/Layer.tsx (1)
  • Layer (13-22)
src/util/types.ts (1)
  • adaptEventsOfChild (875-897)
src/util/ScatterUtils.tsx (1)
  • ScatterSymbol (7-20)
test/state/selectors/selectDisplayedData.spec.tsx (1)
test/helper/expectAxisTicks.ts (1)
  • expectXAxisTicks (12-21)
src/cartesian/CartesianAxis.tsx (4)
src/util/types.ts (1)
  • CartesianTickItem (768-772)
src/container/Layer.tsx (1)
  • Layer (13-22)
src/zindex/ZIndexLayer.tsx (1)
  • ZIndexLayer (49-108)
src/zindex/DefaultZIndexes.tsx (1)
  • DefaultZIndexes (4-81)
test/cartesian/YAxis/YAxis.spec.tsx (1)
test/helper/expectAxisTicks.ts (1)
  • expectYAxisTicks (23-32)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: Build, Test, Pack
  • GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (6)
test/helper/expectAxisTicks.ts (1)

13-13: LGTM! Selector updates are consistent with the DOM restructuring.

The updated selectors correctly target tick labels within the new axis-specific tick-label wrapper containers, maintaining consistency between XAxis and YAxis helpers.

Also applies to: 24-24

src/cartesian/Scatter.tsx (1)

352-374: LGTM! Z-index layering is correctly implemented.

The ZIndexLayer wrapping with conditional zIndex based on active state ensures active scatter points render above inactive ones. Event handlers are properly preserved on the inner Layer, and the comment clearly explains the undefined vs. activeDot zIndex behavior.

test/chart/ScatterChart.spec.tsx (1)

409-412: LGTM! Test now correctly interacts with the actual active shape element.

The change to capture and interact with the active shape element (instead of assuming sector2) makes the test more robust to DOM structural changes introduced by the ZIndexLayer portal rendering.

test/cartesian/YAxis/YAxis.spec.tsx (2)

589-589: LGTM! Selector updates align with the axis tick DOM structure changes.

The updated selectors correctly target the new .recharts-cartesian-axis-tick-label wrapper elements, consistent with the helper changes in test/helper/expectAxisTicks.ts.

Also applies to: 633-633


926-952: LGTM! Using the centralized helper improves test maintainability.

Replacing manual DOM queries with the expectYAxisTicks helper provides a clearer, more maintainable approach to validating axis tick rendering. If the DOM structure changes again, only the helper needs updating.

test/cartesian/XAxis.spec.tsx (1)

769-770: LGTM! Test queries correctly updated for new tick-labels container structure.

The changes consistently use the new .recharts-xAxis-tick-labels container class introduced to support z-index layering for axis ticks. The descendant selectors properly target tick value elements within the container, and the pattern aligns with the updated expectXAxisTicks helper.

Also applies to: 1261-1265, 3188-3189, 3264-3265, 4174-4175

Comment on lines +367 to +380
const tickLines = tickLineCoords.map(({ entry, line: lineCoord }) => {
return (
<Layer
className="recharts-cartesian-axis-tick"
key={`tick-${entry.value}-${entry.coordinate}-${entry.tickCoord}`}
>
{tickLine && (
<line
{...tickLineProps}
{...lineCoord}
className={clsx('recharts-cartesian-axis-tick-line', get(tickLine, 'className'))}
/>
)}
</Layer>
Copy link
Contributor

@coderabbitai coderabbitai bot Nov 3, 2025

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Restore tick events on tick lines

Line 369 onward no longer spreads adaptEventsOfChild onto the tick-line Layer, so axis-level handlers (onClick, onMouseEnter, etc.) stop firing when users interact with the tick line itself. This regresses existing behavior where the combined tick container handled events for both the line and the label. Please reapply the adapted events to the tick-line layer.

-  const tickLines = tickLineCoords.map(({ entry, line: lineCoord }) => {
+  const tickLines = tickLineCoords.map(({ entry, line: lineCoord }, index) => {
     return (
       <Layer
         className="recharts-cartesian-axis-tick"
         key={`tick-${entry.value}-${entry.coordinate}-${entry.tickCoord}`}
+        {...adaptEventsOfChild(events, entry, index)}
       >
         {tickLine && (
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const tickLines = tickLineCoords.map(({ entry, line: lineCoord }) => {
return (
<Layer
className="recharts-cartesian-axis-tick"
key={`tick-${entry.value}-${entry.coordinate}-${entry.tickCoord}`}
>
{tickLine && (
<line
{...tickLineProps}
{...lineCoord}
className={clsx('recharts-cartesian-axis-tick-line', get(tickLine, 'className'))}
/>
)}
</Layer>
const tickLines = tickLineCoords.map(({ entry, line: lineCoord }, index) => {
return (
<Layer
className="recharts-cartesian-axis-tick"
key={`tick-${entry.value}-${entry.coordinate}-${entry.tickCoord}`}
{...adaptEventsOfChild(events, entry, index)}
>
{tickLine && (
<line
{...tickLineProps}
{...lineCoord}
className={clsx('recharts-cartesian-axis-tick-line', get(tickLine, 'className'))}
/>
)}
</Layer>
🤖 Prompt for AI Agents
In src/cartesian/CartesianAxis.tsx around lines 367 to 380, the tick-line Layer
no longer receives the adapted event handlers so axis-level handlers (onClick,
onMouseEnter, etc.) don't fire when interacting with the tick line; reapply the
adapted events by spreading adaptEventsOfChild(entry, props) (or the local
equivalent used elsewhere in this file) onto the Layer that wraps the tick line
(only when tickLine is rendered) so the tick-line Layer and its children receive
the same event adapters as the tick container.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I put the events on labels only as it feels more relevant there. Also it's the larger target.

Copy link
Contributor

Choose a reason for hiding this comment

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

@PavelVanecek That makes sense — labels are indeed the more intuitive and larger interaction target. The behavior change (events no longer firing when clicking directly on the thin tick lines) seems intentional and reasonable given the improved UX.


🧠 Learnings used
Learnt from: CR
Repo: recharts/recharts PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-10-25T07:36:02.229Z
Learning: Recharts aims for simple, declarative, and composable charts; prioritize consistency, usability, performance, and accessibility

Copy link
Member

Choose a reason for hiding this comment

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

Still technically a breaking change

Copy link
Contributor

Choose a reason for hiding this comment

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

Seems like the humans are having a chat. I'll hop back into my burrow for now. If you need me again, just tag @coderabbitai in a new comment, and I'll come hopping out!

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'll risk this one.

otherSvgProps={svgPropertiesNoEvents(props)}
/>
<Ticks
ref={layerRef}
Copy link
Member

Choose a reason for hiding this comment

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

Is this no longer a layer ref?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I needed to ref one layer deeper so I added forwardRef.

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.

2 participants