Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
2 tasks done
webroo opened this issue Oct 4, 2024 · 1 comment
Open
2 tasks done
Labels
Issue: Accepted The submitted issue has been confirmed by the Victory core team Type: Bug 🐛 Oh no! A bug or unintentional behavior

Comments

@webroo
Copy link

webroo commented Oct 4, 2024

Is there an existing issue for this?

  • I have searched the existing issues

Code of Conduct

  • I agree to follow this project's Code of Conduct

Victory version

37.1.1

Code Sandbox link

https://codesandbox.io/p/sandbox/victory-starter-forked-4kq4n4?file=%2Fsrc%2FApp.tsx

Bug report

When specifying Theme.tooltip.style.lineHeight the value is used to calculate the height of the tooltip flyout but not the positioning of text elements inside. This causes a visual mismatch, especially on multiline tooltips.

image

It seems the only workaround is to also supply line height to the tooltip label via props, but this means the value now has to be maintained across two separate places in the code:

<VictoryTooltip labelComponent={<VictoryLabel lineHeight={2} />} />

Ideally we'd only need to maintain line height in one place, the theme.

Steps to reproduce

1. Go to Code Sandbox link and open `Theme.ts`
2. Modify the value of `Theme.tooltip.style.lineHeight`
3. Observe how the height of the tooltip Flyout changes but not the positioning of text elements

Expected behavior

`Theme.tooltip.style.lineHeight` should be used to calculate both the height of the flyout and the position of the text elements.

Actual behavior

`Theme.tooltip.style.lineHeight` is only used to calculate the height of the flyout.

Environment

- Device: Desktop
- OS: MacOS 14.6.1
- Browser: Chrome v129
@webroo webroo added the Type: Bug 🐛 Oh no! A bug or unintentional behavior label Oct 4, 2024
@webroo webroo changed the title Line height not correctly to tooltips Tooltip line height not correctly applied to both flyout and text elements Oct 4, 2024
@carbonrobot carbonrobot added the Issue: Accepted The submitted issue has been confirmed by the Victory core team label Oct 29, 2024
@carbonrobot
Copy link
Contributor

Related to #2835

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue: Accepted The submitted issue has been confirmed by the Victory core team Type: Bug 🐛 Oh no! A bug or unintentional behavior
Projects
None yet
Development

No branches or pull requests

2 participants