: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(insights): make funnel addExclusion target the exclusion row reliably (#62928)
Sam Pennington566e0fdc7f4a
diff --git a/frontend/src/scenes/insights/filters/FunnelExclusionsFilter/ExclusionRowSuffix.tsx b/frontend/src/scenes/insights/filters/FunnelExclusionsFilter/ExclusionRowSuffix.tsxindex 94173791f575..128f28591e8b 100644--- a/frontend/src/scenes/insights/filters/FunnelExclusionsFilter/ExclusionRowSuffix.tsx+++ b/frontend/src/scenes/insights/filters/FunnelExclusionsFilter/ExclusionRowSuffix.tsx@@ -73,29 +73,33 @@ export function ExclusionRowSuffix({)return (- <div className="flex items-center gap-2 w-full p-1 my-1">- <span>between</span>- <LemonSelect- className="min-w-0 flex-shrink"- size="small"- value={stepRange.funnelFromStep || 0}- onChange={onChange}- options={Array.from(Array(numberOfSeries).keys())- .slice(0, -1)- .map((stepIndex) => ({ value: stepIndex, label: `Step ${stepIndex + 1}` }))}- disabled={!isFunnelWithEnoughSteps}- />- <span>and</span>- <LemonSelect- className="min-w-0 flex-shrink"- size="small"- value={stepRange.funnelToStep || (stepRange.funnelFromStep ?? 0) + 1}- onChange={(toStep: number) => onChange(stepRange.funnelFromStep, toStep)}- options={Array.from(Array(numberOfSeries).keys())- .slice((stepRange.funnelFromStep ?? 0) + 1)- .map((stepIndex) => ({ value: stepIndex, label: `Step ${stepIndex + 1}` }))}- disabled={!isFunnelWithEnoughSteps}- />+ <div className="flex flex-wrap items-center gap-x-2 gap-y-1 w-full p-1 my-1">+ <div className="flex flex-shrink-0 items-center gap-2">+ <span>between</span>+ <LemonSelect+ className="flex-shrink-0"+ size="small"+ value={stepRange.funnelFromStep || 0}+ onChange={onChange}+ options={Array.from(Array(numberOfSeries).keys())+ .slice(0, -1)+ .map((stepIndex) => ({ value: stepIndex, label: `Step ${stepIndex + 1}` }))}+ disabled={!isFunnelWithEnoughSteps}+ />+ </div>+ <div className="flex flex-shrink-0 items-center gap-2">+ <span>and</span>+ <LemonSelect+ className="flex-shrink-0"+ size="small"+ value={stepRange.funnelToStep || (stepRange.funnelFromStep ?? 0) + 1}+ onChange={(toStep: number) => onChange(stepRange.funnelFromStep, toStep)}+ options={Array.from(Array(numberOfSeries).keys())+ .slice((stepRange.funnelFromStep ?? 0) + 1)+ .map((stepIndex) => ({ value: stepIndex, label: `Step ${stepIndex + 1}` }))}+ disabled={!isFunnelWithEnoughSteps}+ />+ </div><div className="flex items-center gap-1 ml-auto">{propertyFiltersButton}<LemonButtondiff --git a/frontend/src/scenes/insights/filters/FunnelExclusionsFilter/FunnelExclusionsFilter.tsx b/frontend/src/scenes/insights/filters/FunnelExclusionsFilter/FunnelExclusionsFilter.tsxindex fd7a2d6fd743..5723c5ebed07 100644--- a/frontend/src/scenes/insights/filters/FunnelExclusionsFilter/FunnelExclusionsFilter.tsx+++ b/frontend/src/scenes/insights/filters/FunnelExclusionsFilter/FunnelExclusionsFilter.tsx@@ -37,29 +37,31 @@ export function FunnelExclusionsFilter(): JSX.Element {const typeKey = `${keyForInsightLogicProps('new')(insightProps)}-FunnelExclusionsFilter`return (- <ActionFilter- ref={ref}- setFilters={setFilters}- filters={exclusionFilters}- typeKey={typeKey}- addFilterDefaultOptions={{- id: '$pageview',- name: '$pageview',- type: EntityTypes.EVENTS,- funnel_from_step: exclusionDefaultStepRange.funnelFromStep,- funnel_to_step: exclusionDefaultStepRange.funnelToStep,- }}- disabled={!isFunnelWithEnoughSteps}- buttonCopy="Add exclusion"- actionsTaxonomicGroupTypes={[TaxonomicFilterGroupType.Events]}- mathAvailability={MathAvailability.None}- hideFilter- hideRename- hideDeleteBtn- seriesIndicatorType="alpha"- renderRow={(props) => <ExclusionRow {...props} />}- customRowSuffix={(props) => <ExclusionRowSuffix typeKey={typeKey} {...props} />}- filtersLeftPadding={true}- />+ <div data-attr="funnel-exclusions-filter">+ <ActionFilter+ ref={ref}+ setFilters={setFilters}+ filters={exclusionFilters}+ typeKey={typeKey}+ addFilterDefaultOptions={{+ id: '$pageview',+ name: '$pageview',+ type: EntityTypes.EVENTS,+ funnel_from_step: exclusionDefaultStepRange.funnelFromStep,+ funnel_to_step: exclusionDefaultStepRange.funnelToStep,+ }}+ disabled={!isFunnelWithEnoughSteps}+ buttonCopy="Add exclusion"+ actionsTaxonomicGroupTypes={[TaxonomicFilterGroupType.Events]}+ mathAvailability={MathAvailability.None}+ hideFilter+ hideRename+ hideDeleteBtn+ seriesIndicatorType="alpha"+ renderRow={(props) => <ExclusionRow {...props} />}+ customRowSuffix={(props) => <ExclusionRowSuffix typeKey={typeKey} {...props} />}+ filtersLeftPadding={true}+ />+ </div>)}diff --git a/playwright/page-models/insights/funnelsInsight.ts b/playwright/page-models/insights/funnelsInsight.tsindex 0d45be286465..aff03bc92112 100644--- a/playwright/page-models/insights/funnelsInsight.ts+++ b/playwright/page-models/insights/funnelsInsight.ts@@ -83,12 +83,20 @@ export class FunnelsInsight {async addExclusion(eventName: string): Promise<void> {await this.expandFunnelSettings()- const addButton = this.page.getByRole('button', { name: 'Add exclusion' })+ // Scope to the exclusions container — the exclusion row's event picker shares the+ // `trend-element-subject-0` testid with the main series' first step, so a bare+ // `.last()` can land on the wrong control before the exclusion row has rendered.+ const exclusions = this.page.getByTestId('funnel-exclusions-filter')+ const addButton = exclusions.getByRole('button', { name: 'Add exclusion' })await addButton.scrollIntoViewIfNeeded()await addButton.click()- await this.page.getByTestId('trend-element-subject-0').last().click()+ const eventButton = exclusions.getByTestId('trend-element-subject-0').last()+ await eventButton.click()await this.taxonomicFilter.selectItem(eventName)+ // The exclusion defaults to $pageview; confirm the chosen event actually applied+ // before returning, otherwise the funnel recomputes against the wrong exclusion.+ await expect(eventButton).toContainText(eventName)}async selectLayout(label: string): Promise<void> {