Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

fix(insights): show full cell content on hover in table insights (#63276)

Sam Pennington502806294293
diff --git a/frontend/src/queries/nodes/DataVisualization/Components/Table.tsx b/frontend/src/queries/nodes/DataVisualization/Components/Table.tsx
index cd202fc6c5ec..c9b87cf58b6d 100644
--- a/frontend/src/queries/nodes/DataVisualization/Components/Table.tsx
+++ b/frontend/src/queries/nodes/DataVisualization/Components/Table.tsx
@@ -58,6 +58,19 @@ function getDisplayedColumnTitle(
return label || title || columnName
}
+// Plain-text representation of a cell, used as the hover title so clipped content is
+// still visible on hover. The full value stays in the DOM (CSS ellipsis only), so
+// selecting and copying a cell copies the whole value, not just the clipped portion.
+function getCellTitle(cell: TableDataCell<any>): string | undefined {
+ if (typeof cell.formattedValue === 'string') {
+ return cell.formattedValue
+ }
+ if (typeof cell.value === 'string' || typeof cell.value === 'number') {
+ return String(cell.value)
+ }
+ return undefined
+}
+
export const Table = (props: TableProps): JSX.Element => {
const { isDarkModeOn } = useValues(themeLogic)
@@ -130,11 +143,18 @@ export const Table = (props: TableProps): JSX.Element => {
? sourceColumnTitle
: String(sourceColumnTitle)
- return <div className="truncate">{renderedSourceColumnTitle}</div>
+ return (
+ <div
+ className="truncate"
+ title={typeof sourceColumnTitle === 'string' ? sourceColumnTitle : undefined}
+ >
+ {renderedSourceColumnTitle}
+ </div>
+ )
}
return (
- <div className="truncate">
+ <div className="truncate" title={getCellTitle(cell)}>
{renderColumn(
cell.sourceColumnName ?? column.name,
cell.formattedValue,
diff --git a/frontend/src/scenes/insights/utils.test.ts b/frontend/src/scenes/insights/utils.test.ts
index a7aeb8a9dcbb..adc2f88c1897 100644
--- a/frontend/src/scenes/insights/utils.test.ts
+++ b/frontend/src/scenes/insights/utils.test.ts
@@ -346,6 +346,17 @@ describe('formatBreakdownLabel()', () => {
expect(formatBreakdownLabel(input, breakdownFilter, [], identity)).toEqual(expected)
})
+ it.each([
+ ['201 chars stays intact', 'b'.repeat(201)],
+ ['very long HTML error page stays intact', '<html>' + 'x'.repeat(22000) + '</html>'],
+ ])('keeps full label when truncation is disabled: %s', (_desc, input) => {
+ const breakdownFilter: BreakdownFilter = {
+ breakdown: 'error_message',
+ breakdown_type: 'event',
+ }
+ expect(formatBreakdownLabel(input, breakdownFilter, [], identity, undefined, undefined, false)).toEqual(input)
+ })
+
it('handles multi-breakdowns', () => {
const breakdownFilter: BreakdownFilter = {
breakdown: ['demographic', '$browser'],
diff --git a/frontend/src/scenes/insights/utils.tsx b/frontend/src/scenes/insights/utils.tsx
index 66c711599baf..8ec0f73a0732 100644
--- a/frontend/src/scenes/insights/utils.tsx
+++ b/frontend/src/scenes/insights/utils.tsx
@@ -348,11 +348,22 @@ export function formatBreakdownLabel(
cohorts: CohortType[] | undefined,
formatPropertyValueForDisplay: FormatPropertyValueForDisplayFunction | undefined,
multipleBreakdownIndex?: number,
- itemLabel?: string
+ itemLabel?: string,
+ truncateLabel: boolean = true
): string {
if (Array.isArray(breakdown_value)) {
return breakdown_value
- .map((v, index) => formatBreakdownLabel(v, breakdownFilter, cohorts, formatPropertyValueForDisplay, index))
+ .map((v, index) =>
+ formatBreakdownLabel(
+ v,
+ breakdownFilter,
+ cohorts,
+ formatPropertyValueForDisplay,
+ index,
+ undefined,
+ truncateLabel
+ )
+ )
.join('::')
}
@@ -365,14 +376,18 @@ export function formatBreakdownLabel(
breakdownFilter,
cohorts,
formatPropertyValueForDisplay,
- multipleBreakdownIndex
+ multipleBreakdownIndex,
+ undefined,
+ truncateLabel
)
const formattedBucketEnd = formatBreakdownLabel(
bucketEnd,
breakdownFilter,
cohorts,
formatPropertyValueForDisplay,
- multipleBreakdownIndex
+ multipleBreakdownIndex,
+ undefined,
+ truncateLabel
)
if (formattedBucketStart === formattedBucketEnd) {
return formattedBucketStart
@@ -437,7 +452,7 @@ export function formatBreakdownLabel(
? BREAKDOWN_NULL_DISPLAY
: breakdown_value
- if (label.length > 200) {
+ if (truncateLabel && label.length > 200) {
return label.slice(0, 200) + '…'
}
return label
diff --git a/frontend/src/scenes/insights/views/InsightsTable/InsightsTable.tsx b/frontend/src/scenes/insights/views/InsightsTable/InsightsTable.tsx
index 55e314971c12..cc7992ac808d 100644
--- a/frontend/src/scenes/insights/views/InsightsTable/InsightsTable.tsx
+++ b/frontend/src/scenes/insights/views/InsightsTable/InsightsTable.tsx
@@ -138,6 +138,7 @@ export function InsightsTable({
hasBreakdownFilter(breakdownFilter) &&
!(breakdownFilter.breakdowns && breakdownFilter.breakdowns.length > 1)
+ // Untruncated — BreakdownColumnItem clips for display but needs the full value for hover and copy
const formatItemBreakdownLabel = hasBreakdownFilter(breakdownFilter)
? (item: IndexedTrendResult): string =>
formatBreakdownLabel(
@@ -145,7 +146,9 @@ export function InsightsTable({
breakdownFilter,
allCohorts?.results,
formatPropertyValueForDisplay,
- breakdownFilter.breakdowns ? 0 : undefined
+ breakdownFilter.breakdowns ? 0 : undefined,
+ undefined,
+ false
)
: undefined
@@ -275,7 +278,9 @@ export function InsightsTable({
breakdownFilter,
allCohorts?.results,
formatPropertyValueForDisplay,
- index
+ index,
+ undefined,
+ false
)
const columnKey = `breakdown-${breakdown.property?.toString() || index}`
diff --git a/frontend/src/scenes/insights/views/InsightsTable/columns/BreakdownColumn.tsx b/frontend/src/scenes/insights/views/InsightsTable/columns/BreakdownColumn.tsx
index 2cc67da5885c..4082a5131bc5 100644
--- a/frontend/src/scenes/insights/views/InsightsTable/columns/BreakdownColumn.tsx
+++ b/frontend/src/scenes/insights/views/InsightsTable/columns/BreakdownColumn.tsx
@@ -94,16 +94,23 @@ export function BreakdownColumnItem({
? parseAliasToReadable(breakdownLabel)
: stringWithWBR(breakdownLabel, 20)
+ // Clipped with CSS only, so the full value stays in the DOM — copying the cell copies everything
return (
<div className="flex justify-between items-center">
{breakdownLabel && (
<>
{isURL(breakdownLabel) ? (
- <Link to={breakdownLabel} target="_blank" className="value-link font-medium" targetBlankIcon>
+ <Link
+ to={breakdownLabel}
+ target="_blank"
+ className="value-link font-medium line-clamp-4"
+ title={breakdownLabel}
+ targetBlankIcon
+ >
{formattedLabel}
</Link>
) : (
- <div title={breakdownLabel} className="font-medium">
+ <div title={breakdownLabel} className="font-medium line-clamp-4">
{formattedLabel}
</div>
)}