Skip to content

Commit 9f67463

Browse files
pauldambraclaude
andcommitted
fix(paths): use Popover instead of LemonDropdown for consistent card styling
LemonDropdown was adding its own visual treatment to the trigger element when open, making card-hovered and path-hovered states look different. Switch to Popover with controlled visibility so the card's inline active styles are the only visual treatment. Also remove the competing CSS :hover box-shadow. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent bb0efd4 commit 9f67463

File tree

2 files changed

+19
-12
lines changed

2 files changed

+19
-12
lines changed

frontend/src/scenes/paths/PathNodeCard.tsx

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { useActions, useValues } from 'kea'
2-
import { useRef } from 'react'
2+
import { useRef, useState } from 'react'
33

4-
import { LemonDropdown } from '@posthog/lemon-ui'
4+
import { Popover } from 'lib/lemon-ui/Popover'
55

66
import { FunnelPathsFilter } from '~/queries/schema/schema-general'
77
import { InsightLogicProps } from '~/types'
@@ -28,6 +28,7 @@ export function PathNodeCard({
2828
onMouseLeave,
2929
}: PathNodeCardProps): JSX.Element | null {
3030
const cardRef = useRef<HTMLDivElement>(null)
31+
const [popoverVisible, setPopoverVisible] = useState(false)
3132
const { pathsFilter: _pathsFilter, funnelPathsFilter: _funnelPathsFilter } = useValues(pathsDataLogic(insightProps))
3233
const { updateInsightFilter, openPersonsModal, viewPathToFunnel } = useActions(pathsDataLogic(insightProps))
3334

@@ -48,8 +49,19 @@ export function PathNodeCard({
4849
node.targetLinks.length
4950
: null
5051

52+
const handleMouseEnter = (): void => {
53+
setPopoverVisible(true)
54+
onMouseEnter?.()
55+
}
56+
57+
const handleMouseLeave = (): void => {
58+
setPopoverVisible(false)
59+
onMouseLeave?.()
60+
}
61+
5162
return (
52-
<LemonDropdown
63+
<Popover
64+
visible={popoverVisible}
5365
overlay={
5466
<PathNodeCardMenu
5567
name={node.name}
@@ -62,15 +74,10 @@ export function PathNodeCard({
6274
openPersonsModal={openPersonsModal}
6375
/>
6476
}
65-
trigger="hover"
6677
placement="bottom"
6778
padded={false}
6879
matchWidth
69-
onVisibilityChange={(visible) => {
70-
if (!visible && !cardRef.current?.matches(':hover')) {
71-
onMouseLeave?.()
72-
}
73-
}}
80+
onMouseLeaveInside={handleMouseLeave}
7481
>
7582
<div
7683
ref={cardRef}
@@ -96,7 +103,8 @@ export function PathNodeCard({
96103
opacity: node.active ? 1 : undefined,
97104
}}
98105
data-attr="path-node-card-button"
99-
onMouseEnter={onMouseEnter}
106+
onMouseEnter={handleMouseEnter}
107+
onMouseLeave={handleMouseLeave}
100108
>
101109
<PathNodeCardButton
102110
name={node.name}
@@ -110,6 +118,6 @@ export function PathNodeCard({
110118
tooltipContent={pageUrl(node, true, true)}
111119
/>
112120
</div>
113-
</LemonDropdown>
121+
</Popover>
114122
)
115123
}

frontend/src/scenes/paths/Paths.scss

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212

1313
.PathNodeCard:hover {
1414
z-index: 20 !important;
15-
box-shadow: 0 2px 8px rgb(0 0 0 / 15%);
1615
}
1716

1817
// When any card is active, dim the non-active cards

0 commit comments

Comments
 (0)