Skip to content

fix(tooltip): pass lineHeight from style to label component (#2908) - #3088

Open
ErfanBagheri404 wants to merge 1 commit into
FormidableLabs:mainfrom
ErfanBagheri404:fix/tooltip-line-height-prop
Open

fix(tooltip): pass lineHeight from style to label component (#2908)#3088
ErfanBagheri404 wants to merge 1 commit into
FormidableLabs:mainfrom
ErfanBagheri404:fix/tooltip-line-height-prop

Conversation

@ErfanBagheri404

Copy link
Copy Markdown

Summary

VictoryLabel reads lineHeight from props.lineHeight to calculate inter-line spacing (dy between tspans). The tooltip's getLabelProps only forwarded style, so the label always fell back to the default lineHeight: 1, even when the theme supplied a tooltip.style.lineHeight.

Root cause

VictoryTooltip.getLabelProps passed style to the label component, but VictoryLabel reads lineHeight from a dedicated props.lineHeight (line 157 in victory-label.tsx), not from style.lineHeight. With no explicit lineHeight prop, it defaults to [1], so all lines stack tight regardless of the theme setting.

Fix

Extract lineHeight from the evaluated style object in getLabelProps and pass it as a dedicated prop. This is consistent with how other label props (textAnchor, angle) are already forwarded.

Test

Added a test that renders a multiline tooltip label with style: { lineHeight: 2, fontSize: 12 } and verifies the second tspan's dy is greater than 0 (reflecting the multiplier). All 6 tests pass.

Closes #2908

`VictoryLabel` reads `lineHeight` from its `props.lineHeight` to
calculate inter-line spacing (dy between tspans). The tooltip's
`getLabelProps` only forwarded `style`, so the label always fell back
to the default `lineHeight: 1`, even when the theme supplied a
`tooltip.style.lineHeight` (e.g. for a larger flyout).

Extract `lineHeight` from the evaluated `style` object and pass it
as a dedicated prop, consistent with how other label props (textAnchor,
angle, etc.) are forwarded.

Closes FormidableLabs#2908
@vercel

vercel Bot commented Aug 17, 2026

Copy link
Copy Markdown

@ErfanBagheri404 is attempting to deploy a commit to the Nearform Team on Vercel.

A member of the Team first needs to authorize it.

@changeset-bot

changeset-bot Bot commented Aug 17, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 36f2bca

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

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.

Tooltip line height not correctly applied to both flyout and text elements

1 participant