: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.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
fix(lemon-ui): don't render LemonTag as clickable inside a Tooltip (#58381)
Paul D'Ambraa5765f9d8d96
diff --git a/frontend/src/lib/lemon-ui/LemonTag/LemonTag.tsx b/frontend/src/lib/lemon-ui/LemonTag/LemonTag.tsxindex f0e55b218edc..0a955f3cad7b 100644--- a/frontend/src/lib/lemon-ui/LemonTag/LemonTag.tsx+++ b/frontend/src/lib/lemon-ui/LemonTag/LemonTag.tsx@@ -37,6 +37,8 @@ export interface LemonTagProps {'data-attr'?: string/** When true, the icon will swap to a close icon on hover and the entire tag becomes clickable to close */closeOnClick?: boolean+ /** Keep the cursor-pointer / role="button" affordance even when wrapped in a `<Tooltip>` (Base UI's tooltip injects its own onClick which would otherwise suppress it). */+ forceClickable?: boolean}export const LemonTag: React.FunctionComponent<@@ -54,27 +56,29 @@ export const LemonTag: React.FunctionComponent<popover,disabledReason,closeOnClick,+ onClick,+ forceClickable,...props},ref): JSX.Element {+ // Base UI's Tooltip injects an onClick onto its trigger child; don't treat that as dev intent unless forceClickable is set.+ const isTooltipTrigger = 'data-base-ui-tooltip-trigger' in props+ const isCloseClickable = !!(closeOnClick && icon && onClose)+ const isClickable = (!!onClick && (!isTooltipTrigger || forceClickable)) || isCloseClickablereturn (<divref={ref}className={clsx('LemonTag',`LemonTag--size-${size}`,- disabledReason- ? 'cursor-not-allowed'- : props.onClick || (closeOnClick && icon && onClose)- ? 'cursor-pointer'- : undefined,+ disabledReason ? 'cursor-not-allowed' : isClickable ? 'cursor-pointer' : undefined,`LemonTag--${type}`,weight && `LemonTag--${weight}`,closeOnClick && 'LemonTag--close-on-click',className)}- role={props.onClick || (closeOnClick && icon && onClose) ? 'button' : undefined}+ role={isClickable ? 'button' : undefined}title={disabledReason || undefined}aria-disabled={disabledReason ? true : undefined}{...props}@@ -84,7 +88,7 @@ export const LemonTag: React.FunctionComponent<e.stopPropagation()onClose()}- : props.onClick+ : onClick}>{icon && closeOnClick && onClose ? (diff --git a/frontend/src/scenes/settings/user/PersonalAPIKeys.tsx b/frontend/src/scenes/settings/user/PersonalAPIKeys.tsxindex fc5fcdd6f2ce..b35942d17bd8 100644--- a/frontend/src/scenes/settings/user/PersonalAPIKeys.tsx+++ b/frontend/src/scenes/settings/user/PersonalAPIKeys.tsx@@ -291,7 +291,9 @@ export function TagList({ tags, onMoreClick }: TagListProps): JSX.Element {))}{tags.length > 4 && (<Tooltip title={tags.slice(4).join(', ')}>- <LemonTag onClick={onMoreClick}>+{tags.length - 4} more</LemonTag>+ <LemonTag onClick={onMoreClick} forceClickable>+ +{tags.length - 4} more+ </LemonTag></Tooltip>)}</span>@@ -318,7 +320,9 @@ export function TagListWithRestrictions({ tags, onMoreClick }: TagListWithRestri.map((tag) => tag.name).join(', ')}>- <LemonTag onClick={onMoreClick}>+{tags.length - 4} more</LemonTag>+ <LemonTag onClick={onMoreClick} forceClickable>+ +{tags.length - 4} more+ </LemonTag></Tooltip>)}</span>