You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[popups] Fix positioner not repositioning to a different trigger when reopened with keepMounted - #4407
This is a focused bug-fix PR in shared popup positioning. The positionReference reset matches the stale-reference failure mode for keepMounted reopen flows, and the added Chromium regression reproduces the preview-card case directly.
1. Bugs / Issues (None)
2. Root Cause & Patch Assessment
Area
Assessment
Notes
Root-cause fit
Strong
Resetting positionReference on the closed keepMounted path addresses the store state that was still pointing at the previous trigger when the popup reopened.
Patch scope
Narrow
The change is a single store reset in the shared positioning hook, which keeps the blast radius small.
Shared-hook impact
Appropriate
This bug lives below the component layer, so fixing it in useAnchorPositioning is the right level.
3. Pattern Consistency Assessment
Area
Status
Notes
Floating root sync
Consistent
The reset now matches the other fields already nulled on close, so the store no longer carries stale reference state across reopen cycles.
Reopen behavior
Improved
The hook can now resume from a clean reference state instead of inheriting the last trigger’s positioning input.
4. Simplification Opportunities
No simplification issue stands out here. The patch is already minimal and directly tied to the bug.
5. Edge Cases Worth Noting
Area
Status
Notes
Preview-card hover path
Covered
The new test exercises the reported close-then-reopen path with keepMounted.
Nearby shared positioning behavior
Low risk
pnpm test:chromium PopoverPositioner --no-watch also passed, which is a useful sanity check on another keepMounted consumer.
6. Test Coverage Assessment
Strengths: The new Chromium regression is well targeted. It verifies that the positioner aligns to trigger 1, remains mounted while hidden, then realigns to trigger 2 after reopen.
Gaps: The PR description says the same bug reproduces in tooltip, popover, and menu as well, but this branch only adds the explicit reopen-and-reposition regression for preview-card. Because the fix is in the shared hook, I do not see evidence of a remaining runtime defect from the code itself, but adding at least one click-driven keepMounted multi-trigger regression in popover or menu would better protect that broader claim over time.
Validation run:pnpm test:chromium PreviewCardRoot.detached-triggers --no-watch and pnpm test:chromium PopoverPositioner --no-watch both passed.
Merge Confidence Score
Dimension
Score
Notes
Root cause coverage
4/5
The fix lines up with the stale-reference failure mode.
Regression coverage
4/5
The reported preview-card path is explicitly covered; adjacent popup families are still relying on shared-hook confidence rather than their own dedicated regression.
Validation evidence
4/5
Targeted Chromium validation passed on the new regression and one nearby shared-hook consumer.
Overall merge confidence is 4/5. I would be comfortable merging this as-is; adding one more cross-family regression would just improve long-term protection for the broader PR claim.
atomiks
changed the title
[preview-card] Fix positioner not repositioning to a different trigger when reopened with keepMounted
[popups] Fix positioner not repositioning to a different trigger when reopened with keepMountedMar 23, 2026
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
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.
fixes #4222
This issue occurs in all components that have a popup and use keepMounted.
The same issue also appears in these components:
tooltip,popover, andmenu.new link : https://deploy-preview-4407--base-ui.netlify.app/experiments/preview-card/triggers