Skip to content

experimental/SelectPanel: Recalculate position when panel opens - #4321

Merged
siddharthkp merged 2 commits into
mainfrom
drafts-selectpanel-inside-sidebar
Feb 28, 2024
Merged

experimental/SelectPanel: Recalculate position when panel opens#4321
siddharthkp merged 2 commits into
mainfrom
drafts-selectpanel-inside-sidebar

Conversation

@siddharthkp

@siddharthkpsiddharthkp commented Feb 28, 2024

Copy link
Copy Markdown
Member
BeforeAfter
Panel is not positioned correctly inside a DialogPanel is positioned correctly inside a Dialog
Panel is not positioned correctly inside another DialogPanel is positioned correctly

It's a one line change :)

When SelectPanel is inside a component that's not already on the screen, the position is calculated while the parent element is still animating in. This can be fixed easily by forcing a re-calculation when the dialog is opened

const {position} = useAnchoredPosition(
settings,
- [anchorRef.current, dialogRef.current],+ [internalOpen, anchorRef.current, dialogRef.current],
)

@changeset-bot

changeset-botBot commented Feb 28, 2024

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 6c46a27

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
NameType
@primer/reactPatch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@siddharthkpsiddharthkp self-assigned this Feb 28, 2024
@siddharthkp
siddharthkp marked this pull request as ready for review February 28, 2024 15:54
@siddharthkp
siddharthkp requested a review from a teamFebruary 28, 2024 15:54
@github-actions

github-actionsBot commented Feb 28, 2024

Copy link
Copy Markdown
Contributor

size-limit report 📦

PathSize
packages/react/dist/browser.esm.js113.49 KB (0%)
packages/react/dist/browser.umd.js114.17 KB (0%)

@siddharthkp
siddharthkp added this pull request to the merge queueFeb 28, 2024
Merged via the queue into main with commit 94052a3Feb 28, 2024
@siddharthkp
siddharthkp deleted the drafts-selectpanel-inside-sidebar branch February 28, 2024 16:40
@primerprimerBot mentioned this pull request Feb 28, 2024
lukasoppermann pushed a commit that referenced this pull request Apr 16, 2024
* recalculate position on open
* Create curvy-fireants-promise.md
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@siddharthkp@joshblack