Repository navigation
feat(experiments): add breakdown attribution to the metric row group #61788
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
rodrigoi
wants to merge
15
commits into
master
from
experiments/breakdown-attribution-metric-row-group
Closed
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
17c08d1
feat(experiments): add breakdown attribution to the metric row group
rodrigoi 7c1fbdc
chore: update OpenAPI generated types
tests-posthog[bot] 0a87ce1
feat(experiments): adding breakdown limit property to the UI.
rodrigoi 48dca52
fix(experiments): removing em-dashes from attribution tooltio
rodrigoi 5ef9e4d
fix(experiments): using shared metrics metadata to store breakdown va…
rodrigoi c3d3c09
fix(experiments): using shared metrics metadata to store breakdown va…
rodrigoi c11841d
fix(experiments): update components to handble unordered funnels
rodrigoi 4510b66
fix(experiments): sorting feature flags alphabetically
rodrigoi 262e733
fix(experiments): import shared funnel step count limit constant
rodrigoi ab409da
fix(experiments): correct attribution tooltip copy for all steps and …
rodrigoi c2645c4
fix(experiments): clarify breakdown limit has no backend max clamp
rodrigoi b2eb39c
fix(experiments): only merge attribution metadata onto funnel metrics
rodrigoi 0d621a2
fix(experiments): derive isPrimary from shared metric metadata in bre…
rodrigoi 7044d86
chore(experiments): format metrics table attribution handler
rodrigoi 7576a14
fix(experiments): await metric config save before recalculation
posthog[bot] File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The collapse header contains nested buttons
Why we think it's a valid issue
LemonCollapserenders a panel header, whatLemonSelectrenders, and whether the nesting is new or pre-existing in this component.LemonCollapsePanelwrapsheaderChildrenin aLemonButton—frontend/src/lib/lemon-ui/LemonCollapse/LemonCollapse.tsx:151-166for the expandable case,:167-174for the disabled case.LemonSelectrenders its trigger as aLemonButton(frontend/src/lib/lemon-ui/LemonSelect/LemonSelect.tsx:157), which emits a real<button>. SoMetricBreakdownAttributionandMetricBreakdownLimitboth land inside the header<button>atMetricRowGroup.tsx:284-293.validateDOMNestingtreats<button>inside<button>as invalid and logs a warning on every render of an expanded metric row.LemonCollapseacceptsheaderasLemonButtonProps(LemonCollapse.tsx:15and:140-144), andsideActionrenders the extra control as a sibling of the toggle inside a wrapper div, not a descendant (frontend/src/lib/lemon-ui/LemonButton/LemonButton.tsx:312-338).frontend/src/scenes/hog-functions/mapping/HogFunctionMappings.tsx:311-336uses that pattern. So the fix is available without new component work.BreakdownTagwithonClose, which emits a nestedLemonButtonclose control (frontend/src/scenes/insights/filters/BreakdownFilter/BreakdownTag.tsx:183-195). The PR extends an existing defect rather than creating one.onClickstops the click before it reaches the toggle handler, and the select's popover renders in a portal outside the button.consider. The defect is real and deterministic, but it predates the PR in the same header, it breaks no user-visible behavior, and the two added controls widen an existing condition rather than opening a new failure mode.Issue description
LemonCollapse renders its header as a LemonButton. Both new selectors also render LemonButton controls. This creates invalid nested button markup and unclear screen-reader semantics. Stopping click propagation does not fix the HTML structure.
Suggested fix
Render the selectors outside the collapse toggle button. Alternatively, update the header API to render the toggle and its actions as sibling controls.
Prompt to fix with AI (copy-paste)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Confirmed: the collapse header is always rendered inside a
LemonButton(LemonCollapse has no non-button header variant), so the attribution/limitLemonSelecttriggers and the chip close buttons do end up as nested<button>s. Stopping click propagation avoids the toggle firing but doesn't change the HTML nesting or the accessible-name computation, as you note.I'm escalating rather than fixing this unattended, for two reasons. First, this isn't new to the PR — the header already nested a button on master (the breakdown chip's close control), so this change widens an existing condition rather than opening a new one, and there's no functional break for mouse or keyboard users. Second, the two clean fixes are both bigger than a mechanical change: moving the controls out of the collapse header is a layout decision whose result needs to be eyeballed, and the
sideActionroute doesn't fit here —sideActionrenders its contents inside a secondLemonButton, so a whole chips-plus-two-selects row would just re-nest the same buttons. A proper sibling-controls fix means either restructuring this header's layout or extending the sharedLemonCollapseheader API, which reaches beyond this PR's scope.Decision for a human: whether to invest in restructuring the breakdown row so the interactive controls render as siblings of the collapse toggle (and if so, header-layout change here vs. a
LemonCollapseAPI addition), or to accept the pre-existing nesting as-is.