[preview card] Keep inline preview anchored while open#4836
Conversation
commit: |
Bundle size
PerformanceTotal duration: 1,068.25 ms -104.27 ms(-8.9%) | Renders: 50 (+0) | Paint: 1,635.05 ms -192.39 ms(-10.5%) No significant changes — details Check out the code infra dashboard for more information about this PR. |
✅ Deploy Preview for base-ui ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
fcd013a to
46c82ca
Compare
Codex Review (GPT-5.5)I reviewed PR 4836 as a bug-fix against freshly fetched 1. Bugs / Issues1. 🟡 Browser regression test still false-passes against the old behavior (non-blocking)
await user.pointer([
{ target: document.body },
{
target: trigger,
coords: {
clientX: secondLineRect.left + secondLineRect.width / 2,
clientY: secondLineRect.top + secondLineRect.height / 2,
},
},
]);
expectWithin(positioner.getBoundingClientRect().y, firstLineRect.bottom + 5);The old implementation updates Fix: After entering the second line, force or wait for the same positioning update path that exposed the jump, then assert the position still tracks Root Cause & Patch AssessmentThe code change itself is sound: Test Coverage AssessmentI ran: pnpm test:jsdom inlineRect --no-watch
pnpm test:chromium PreviewCardPositioner --no-watchBoth passed on the PR branch. I also checked regression sensitivity against the old implementation: the updated helper test fails as expected, but the updated browser test still passes, which is the coverage gap above. RecommendationApprove after nits are addressed 🟡 The runtime fix looks correct, and the helper regression coverage is meaningful. I’d tighten the browser test before merging so the user-facing Preview Card behavior is protected too. |
46c82ca to
a39b08a
Compare
Code Review (GPT-5.5)Approve ✅ because the inline-rect change matches the intended stable-open behavior, keeps reopen/new-trigger paths intact, and the targeted regression coverage passes. 1. Bugs / Issues (None)Root Cause & Patch AssessmentThe fix is appropriately narrow: The existing native Test Coverage AssessmentValidated against a freshly fetched Ran: pnpm test:jsdom inlineRect --no-watch
pnpm test:chromium PreviewCardPositioner --no-watchBoth passed. I did not separately execute the updated regression test against base-only source, but by inspection the previous |
The React Compiler browser CI exposed a multiline Preview Card test that expected the popup to move to a newly entered line while it was already open. Keeping the opened anchor stable is less disorienting; a new line is only used when opening or reopening.
https://deploy-preview-4836--base-ui.netlify.app/experiments/inline-positioning
With
delayenabled, it won't choose a new rect while open. Matches WikipediaRoot cause
Inline hover coordinates were refreshed on same-trigger mouseenter while open, so incidental positioning updates could make the popup jump.
Changes