Conversation
Convert newlines in data-tooltip content to <br/> elements so that tooltips render with line breaks. Both HTML entity &marimo-team#10; and literal \n are handled, since html-react-parser decodes &marimo-team#10; to \n before the transform runs. Fixes marimo-team#10808
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
All contributors have signed the CLA ✍️ ✅ |
for more information, see https://pre-commit.ci
|
I have read the CLA Document and I hereby sign the CLA |
|
@cubic-ai-dev |
@mscolnick I have started the AI code review. It will take a few minutes to complete. |
|
Closing in favor of #10851, which preserves @lesbass's original implementation, tests, and Git authorship and adds a one-line fix for the unused GitHub denied maintainer push access to this fork, so the replacement is on a branch in marimo-team/marimo. Thank you, @lesbass, for the multiline tooltip fix! |
Preserve line breaks in `data-tooltip` text by converting newlines to `<br />` elements. This handles both literal newlines and decoded ` ` entities while keeping single-line tooltip content as a string. Fixes #10808. Supersedes #10812. ## Contributor credit The implementation and regression tests were authored by **Stefano Maffeis (@lesbass)** in #10812. This PR preserves his original commit and authorship, along with the original pre-commit formatting commit. The coding agent's only code change removes an unused `Fragment` import that caused the frontend typecheck to fail. This replacement PR allows the fix to proceed because GitHub denied maintainer push access to the contributor's fork. --------- Co-authored-by: Stefano Maffeis <lesbass@gmail.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Summary
Converts newlines in
data-tooltipcontent to<br/>elements so that tooltips render multiline text with actual line breaks.Fixes #10808.
Root cause
wrapTooltipTargetsinRenderHTML.tsxpassed thedata-tooltipstring verbatim to the Radix<Tooltip>component. Newlines in the string collapsed under the defaultwhite-spaceCSS, making every tooltip a single line. The HTML entity was decoded to\nbyhtml-react-parserbefore reaching the transform, but the resulting\nhad no effect on rendering.Fix
In
wrapTooltipTargets, split the tooltip content on\nand interleave<br/>elements. This keeps the tooltip content as a plain string for the single-line case (zero overhead) and produces React elements with<br/>separators for multiline content.Verification
), literal\nmultiline, and single-line regression.RenderHTML.test.tspass.