Skip to content

experimental/SelectPanel: Recalculate position when panel opens #4321

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

Merged
merged 2 commits into from
Feb 28, 2024

Conversation

siddharthkp
Copy link
Member

@siddharthkp siddharthkp commented Feb 28, 2024

Before After
Panel is not positioned correctly inside a Dialog Panel is positioned correctly inside a Dialog
Panel is not positioned correctly inside another Dialog Panel 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],
  )

Copy link

changeset-bot bot commented Feb 28, 2024

🦋 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
Name Type
@primer/react Patch

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

@siddharthkp siddharthkp 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 team February 28, 2024 15:54
Copy link
Contributor

github-actions bot commented Feb 28, 2024

size-limit report 📦

Path Size
packages/react/dist/browser.esm.js 113.49 KB (0%)
packages/react/dist/browser.umd.js 114.17 KB (0%)

@siddharthkp siddharthkp added this pull request to the merge queue Feb 28, 2024
Merged via the queue into main with commit 94052a3 Feb 28, 2024
@siddharthkp siddharthkp deleted the drafts-selectpanel-inside-sidebar branch February 28, 2024 16:40
@primer primer bot 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 free to 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