Repository navigation
[popups] Fix auto-resize origin for left-anchored popups - #5370
Conversation
commit: |
[popover] Fix auto-resize origin for left-anchored popups
[popover] Fix auto-resize origin for left-anchored popups
✅ Deploy Preview for base-ui ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify project configuration. |
Bundle size
PerformanceTotal duration: 1,122.65 ms -211.65 ms(-15.9%) | Renders: 78 (+0) | Paint: 1,755.54 ms -337.28 ms(-16.1%)
…and 3 more (+7 within noise) — details Check out the code infra dashboard for more information about this PR. |
There was a problem hiding this comment.
Pull request overview
Fixes popup auto-resize anchoring so left-anchored (including logical-to-physical-left) popups get the same “grow toward the anchor” pinning behavior as the already-handled top case.
Changes:
- Update the anchoring-style gate to include physical-left anchoring.
- Add a new unit test intended to validate the anchoring-style mapping across LTR/RTL and logical sides.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| packages/react/src/utils/usePopupAutoResize.ts | Extends the anchoring-styles condition to cover physical-left popups so width transitions pin to the correct edge. |
| packages/react/src/utils/usePopupAutoResize.test.ts | Adds tests for physical-left and logical-side mapping, but currently imports a helper that isn’t exported/defined. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| @@ -0,0 +1,40 @@ | |||
| import { expect } from 'vitest'; | |||
| import { getPopupAnchoringStyles } from './usePopupAutoResize'; | |||
✅ Deploy Preview for base-ui ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify project configuration. |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (1)
packages/react/src/utils/usePopupAutoResize.ts:205
isOriginSidecurrently duplicates the same logical-side checks asisPhysicalLeft, but its value is only used in the finalreturncondition. This makes the branching harder to reason about (and easy to accidentally change incorrectly later). You can simplify by derivingisPhysicalLeftfromside/directiononce and then usingside === 'top' || isPhysicalLeftas the condition.
let isOriginSide = side === 'top';
let isPhysicalLeft = side === 'left';
if (direction === 'rtl') {
isOriginSide = isOriginSide || side === 'inline-end';
isPhysicalLeft = isPhysicalLeft || side === 'inline-end';
} else {
isOriginSide = isOriginSide || side === 'inline-start';
isPhysicalLeft = isPhysicalLeft || side === 'inline-start';
}
✅ Deploy Preview for base-ui ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Add comment to clarify popup anchoring styles handling. Signed-off-by: sai chand <[email protected]>
Left-anchored popups fell through the isOriginSide gate, so they never got the right: 0 pin and resized/animated from the wrong edge (every other side was handled).