Skip to content

fix(dashboards): Prevent double HTML-escaping in chart tooltips#111022

Open
gggritso wants to merge 2 commits intomasterfrom
georgegritsouk/dain-1223-html-entities-show-up-in-chart-tooltips
Open

fix(dashboards): Prevent double HTML-escaping in chart tooltips#111022
gggritso wants to merge 2 commits intomasterfrom
georgegritsouk/dain-1223-html-entities-show-up-in-chart-tooltips

Conversation

@gggritso
Copy link
Member

@gggritso gggritso commented Mar 18, 2026

Prevent double HTML-escaping of series names in time series widget chart tooltips.

When a widget has multiple queries with a groupBy, series names use > as a delimiter (e.g., My Query > prod : count()). The tooltip nameFormatter in TimeSeriesWidgetVisualization called truncationFormatter with escaping enabled, but the outer truncationFormatter in getFormatter (tooltip.tsx) already escapes. This caused > to be double-escaped to >, which rendered as literal > in tooltips.

The fix passes escaped = false to the inner truncationFormatter call, matching the existing pattern in categoricalSeriesWidgetVisualization (line 272-276) and the legend formatter (line 707-714, which has a comment explicitly explaining why escaping is disabled).

The > delimiter has been in series names since Jan 2025 (transformEventsResponseToSeries), but the double-escaping was introduced when TimeSeriesWidgetVisualization was created with its nameFormatter that redundantly escapes.

Fixes DAIN-1223

The tooltip nameFormatter in TimeSeriesWidgetVisualization called
truncationFormatter with escaping enabled, but the outer
truncationFormatter in getFormatter already escapes. This caused
the ">" delimiter in series names (e.g., "My Query > prod : count()")
to be double-escaped to ">", rendering as literal ">" in
tooltips.

Disable escaping in the inner truncationFormatter call, matching the
pattern already used in categoricalSeriesWidgetVisualization and the
legend formatter.

Fixes DAIN-1223
Co-Authored-By: Claude <noreply@anthropic.com>
@gggritso gggritso requested a review from a team as a code owner March 18, 2026 20:26
@linear-code
Copy link

linear-code bot commented Mar 18, 2026

@github-actions github-actions bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Mar 18, 2026
Copy link
Contributor

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

The alias value from `plottable.label` is not HTML-escaped and goes
into raw HTML tooltip strings. Escape it explicitly. For the fallback
path (no alias match), the seriesName is already escaped by
`getFormatter` in tooltip.tsx, so skip escaping to avoid
double-encoding.

Co-Authored-By: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Frontend Automatically applied to PRs that change frontend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants