Skip to content

[@mantine/charts] LineChart, CompositeChart, BubbleChart: Fix textColor and gridColor props being passed as attributes to the DOM node - #9181

Open
coldsmirk wants to merge 1 commit into
mantinedev:masterfrom
coldsmirk:charts-text-color-dom-attribute
Open

[@mantine/charts] LineChart, CompositeChart, BubbleChart: Fix textColor and gridColor props being passed as attributes to the DOM node#9181
coldsmirk wants to merge 1 commit into
mantinedev:masterfrom
coldsmirk:charts-text-color-dom-attribute

Conversation

@coldsmirk

Copy link
Copy Markdown

textColor (and gridColor in CompositeChart and BubbleChart) is read by the vars resolver but never taken out of props, so it stays in ...others and lands on the root div as an attribute. React logs this on every render of a chart that sets it:

React does not recognize the `textColor` prop on a DOM element. If you intentionally want it to appear in the DOM as a custom attribute, spell it as lowercase `textcolor` instead.

Same thing as #7288 / #7349, which fixed BarChart in 7.15.2 and 7.15.3, and #7378 for AreaChart. LineChart, CompositeChart and BubbleChart still have it; every other chart already pulls the two props out before spreading the rest. Ran into it with LineChart on 9.6.0.

The fix is the same one-liner as before. I also added a small test to each of the three files that renders with both props and checks the root element does not carry them – it fails on master without the change.

…lor` and `gridColor` props being passed as attributes to the DOM node
Copilot AI lite review requested due to automatic review settings September 7, 2026 03:34

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.

🟢 Approval recommended

The changes correctly remove the offending props from ...others and add targeted regression tests to prevent the React DOM-attribute warning from returning.

Pull request overview

Fixes React “unrecognized prop” warnings in @mantine/charts by ensuring textColor (and gridColor where applicable) are destructured out of component props so they do not end up in ...others and get spread onto the root DOM element as invalid attributes.

Changes:

  • Remove textColor from LineChart’s ...others by destructuring it from props.
  • Remove gridColor and textColor from CompositeChart and BubbleChart’s ...others by destructuring them from props.
  • Add regression tests for all three charts to ensure these props do not appear as DOM attributes.
File summaries
File Description
packages/@mantine/charts/src/LineChart/LineChart.tsx Destructures textColor to prevent it from being spread to the root element via ...others.
packages/@mantine/charts/src/LineChart/LineChart.test.tsx Adds a regression test asserting textColor/gridColor are not present as DOM attributes.
packages/@mantine/charts/src/CompositeChart/CompositeChart.tsx Destructures gridColor and textColor to prevent invalid DOM attributes on the root element.
packages/@mantine/charts/src/CompositeChart/CompositeChart.test.tsx Adds a regression test asserting textColor/gridColor are not present as DOM attributes.
packages/@mantine/charts/src/BubbleChart/BubbleChart.tsx Destructures gridColor and textColor to prevent invalid DOM attributes on the root element.
packages/@mantine/charts/src/BubbleChart/BubbleChart.test.tsx Adds a regression test asserting textColor/gridColor are not present as DOM attributes.
Review details
  • Files reviewed: 6/6 changed files
  • Comments generated: 0
  • Review effort level: Lite

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

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