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(error-tracking): make truncated exception message click to expand (#56436)

posthog[bot]2db088ccf10e
diff --git a/frontend/src/lib/components/Errors/Exception/CollapsibleExceptionHeader.tsx b/frontend/src/lib/components/Errors/Exception/CollapsibleExceptionHeader.tsx
index 1a0d4859a5ed..70e096c70f91 100644
--- a/frontend/src/lib/components/Errors/Exception/CollapsibleExceptionHeader.tsx
+++ b/frontend/src/lib/components/Errors/Exception/CollapsibleExceptionHeader.tsx
@@ -66,9 +66,37 @@ export function CollapsibleExceptionHeader({
<div>
<div
ref={valueRef}
+ // When clamped, the div itself becomes the primary expand affordance —
+ // users naturally click the truncated text. The explicit button below
+ // stays for discoverability. Skip the toggle if the user is selecting text.
+ onClick={
+ !truncate && isClamped
+ ? () => {
+ const selection = window.getSelection()
+ if (selection && selection.toString().length > 0) {
+ return
+ }
+ setExpanded(!expanded)
+ }
+ : undefined
+ }
+ onKeyDown={
+ !truncate && isClamped
+ ? (e) => {
+ if (e.key === 'Enter' || e.key === ' ') {
+ e.preventDefault()
+ setExpanded(!expanded)
+ }
+ }
+ : undefined
+ }
+ role={!truncate && isClamped ? 'button' : undefined}
+ tabIndex={!truncate && isClamped ? 0 : undefined}
+ aria-expanded={!truncate && isClamped ? expanded : undefined}
className={cn('text-[var(--gray-8)] leading-6 whitespace-pre-wrap', {
'line-clamp-1': truncate,
'line-clamp-3': !truncate && !expanded,
+ 'cursor-pointer': !truncate && isClamped,
})}
>
{loading ? <LemonSkeleton className="w-[50%] h-2" /> : value}