Fix SelectPanel dialog floating away from trigger on content size change#4092
Draft
Copilot wants to merge 3 commits into
Draft
Fix SelectPanel dialog floating away from trigger on content size change#4092Copilot wants to merge 3 commits into
Copilot wants to merge 3 commits into
Conversation
🦋 Changeset detectedLatest commit: 8832222 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
Copilot
AI
changed the title
[WIP] Fix jumpy behavior of SelectPanel dialog near page bottom
Fix SelectPanel dialog floating away from trigger on content size change
Jun 11, 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Authors: Please fill out this form carefully and completely.
Reviewers: By approving this Pull Request you are approving the code change, as well as its deployment and mitigation plans.
Please read this description carefully. If you feel there is anything unclear or missing, please ask for updates.
What are you trying to accomplish?
Primer::Alpha::SelectPaneldialogs detach from their trigger (appear "jumpy", float toward the middle of the page) when the dialog's rendered size changes after it has been positioned — most visibly withanchor_side: :outside_topnear the bottom of a scrollable page.Root cause:
updateAnchorPositionwas only re-run on windowresize/scrollanddocumentElementresize. For sides whose position depends on the dialog's height (outside-top:top = anchor.top - height - offset), a later size change (e.g. remote content finishing loading) left the dialog pinned at its staletop.Changes (
app/components/primer/alpha/select_panel_element.ts):ResizeObserverondialog:open; remove it ondialog:close.Screenshots
N/A — behavioral positioning fix; no static visual change.
Integration
No production code updates required. Behavior change is contained to the SelectPanel custom element.
List the issues that this change affects.
Risk Assessment
Reuses an existing observer; scoped to the open dialog and cleaned up on close.
What approach did you choose and why?
Observing the dialog's size is the smallest change that addresses the actual trigger — content/size changes after positioning — rather than patching individual load/filter callbacks, which would miss other size-change paths. Observation is bounded to while the dialog is open and unregistered on close to avoid leaking observers.
Anything you want to highlight for special attention from reviewers?
assert_anchored_above_invokeruses a short retry loop because the re-anchor fires asynchronously viaResizeObserverand can't be awaited with Capybara's selector-basedwait:. This mirrors the existingassert_announceshelper in the same file.Accessibility
Merge checklist
Take a look at the What we look for in reviews section of the contributing guidelines for more information on how we review PRs.