Skip to content

fix: support multiline text in data-tooltip attributes (#10808) - #10812

Closed
lesbass wants to merge 2 commits into
marimo-team:mainfrom
one-pr-a-day:fix/multiline-tooltip-10808
Closed

lesbass wants to merge 2 commits into
marimo-team:mainfrom
one-pr-a-day:fix/multiline-tooltip-10808

Conversation

@lesbass

@lesbass lesbass commented Sep 12, 2026

Copy link
Copy Markdown
Contributor

Summary

Converts newlines in data-tooltip content to <br/> elements so that tooltips render multiline text with actual line breaks.

Fixes #10808.

Root cause

wrapTooltipTargets in RenderHTML.tsx passed the data-tooltip string verbatim to the Radix <Tooltip> component. Newlines in the string collapsed under the default white-space CSS, making every tooltip a single line. The HTML entity &#10; was decoded to \n by html-react-parser before reaching the transform, but the resulting \n had no effect on rendering.

Fix

In wrapTooltipTargets, split the tooltip content on \n and 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

  • 3 new unit tests cover: entity-based multiline (&#10;), literal \n multiline, and single-line regression.
  • All 36 tests in RenderHTML.test.ts pass.
  • No existing tests are affected.

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
@vercel

vercel Bot commented Sep 12, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
marimo-docs Ready Ready Preview Sep 12, 2026 11:01am UTC

Request Review

@github-actions

github-actions Bot commented Sep 12, 2026

Copy link
Copy Markdown
Contributor

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@lesbass

lesbass commented Sep 12, 2026

Copy link
Copy Markdown
Contributor Author

I have read the CLA Document and I hereby sign the CLA

@mscolnick

Copy link
Copy Markdown
Contributor

@cubic-ai-dev

@cubic-dev-ai

cubic-dev-ai Bot commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

@cubic-ai-dev

@mscolnick I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-ai Bot 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.

No issues found across 2 files

Re-trigger cubic

@mscolnick mscolnick added the bug Something isn't working label Sep 15, 2026
@mscolnick

Copy link
Copy Markdown
Contributor

Closing in favor of #10851, which preserves @lesbass's original implementation, tests, and Git authorship and adds a one-line fix for the unused Fragment import that failed CI. Stefano is credited explicitly in the replacement PR description.

GitHub denied maintainer push access to this fork, so the replacement is on a branch in marimo-team/marimo. make check and all 36 RenderHTML tests pass locally; the replacement PR is a draft while its CI runs.

Thank you, @lesbass, for the multiline tooltip fix!

@mscolnick mscolnick closed this Sep 15, 2026
mscolnick added a commit that referenced this pull request Sep 15, 2026
Preserve line breaks in `data-tooltip` text by converting newlines to
`<br />` elements. This handles both literal newlines and decoded
`&#10;` 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

data-tooltip does not support multiline text / newline characters

2 participants