Skip to content

fix: add tooltip to truncated span names in HTML report#5164

Merged
thomhurst merged 1 commit intomainfrom
fix/html-report-span-name-tooltip
Mar 14, 2026
Merged

fix: add tooltip to truncated span names in HTML report#5164
thomhurst merged 1 commit intomainfrom
fix/html-report-span-name-tooltip

Conversation

@thomhurst
Copy link
Owner

Summary

  • Adds a title attribute to the .sp-name span element in the trace timeline so that truncated span names show the full name on hover
  • The CSS already applies text-overflow: ellipsis to long span names, but there was no way to see the full text

Test plan

  • Open an HTML report with long span names (e.g. hook: TestHooks.LogTestResult...)
  • Hover over the truncated name and verify the full name appears as a tooltip

Span names with text-overflow:ellipsis now show the full name on hover
via a title attribute.
Copy link
Contributor

@claude claude bot left a comment

Choose a reason for hiding this comment

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

Code Review

This is a clean, minimal fix that improves UX without any downsides.

What the change does

Adds a title attribute to the .sp-name span so browsers display a native tooltip with the full span name on hover — matching the existing behavior already applied to the .sp-bar element on the same row.

Observations

Consistency — The .sp-bar div immediately after this span already had a title attribute (esc(s.name) + ' (' + fmt(s.durationMs) + ')'). This change brings the label span in line with that pattern, making the tooltip behavior consistent across both visual representations of the same span.

Correctnessesc(s.name) is used for both the content and the title attribute value, which is correct. HTML-escaping special characters in attribute values prevents attribute injection (e.g. if a span name contains ").

Minimal footprint — Single-character change (+1/-1). No logic changes, no risk of regression.

Suggestion (minor, optional)

The tooltip on .sp-bar shows duration alongside the name (esc(s.name) + ' (' + fmt(s.durationMs) + ')'). You could optionally do the same here for extra context, but the current approach is perfectly fine — the duration is already visible in the adjacent .sp-dur span.

Approved as-is. Good catch that the label was missing this while the bar already had it.

@thomhurst thomhurst merged commit 1cd048b into main Mar 14, 2026
14 of 15 checks passed
@thomhurst thomhurst deleted the fix/html-report-span-name-tooltip branch March 14, 2026 17:36
@claude claude bot mentioned this pull request Mar 17, 2026
1 task
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.

1 participant