Skip to content

Fix popups with pointer placement not resizing when their content grows - #22624

Merged
MrJul merged 3 commits into
AvaloniaUI:mainfrom
Om-singhaI:fix/pointer-popup-resize
Oct 30, 2026
Merged

MrJul merged 3 commits into
AvaloniaUI:mainfrom
Om-singhaI:fix/pointer-popup-resize

Conversation

@Om-singhaI

Copy link
Copy Markdown
Contributor

What does the pull request do?

Fixes a 12.1.4 regression from #22366: a popup with PlacementMode.Pointer (a ContextMenu opened by right click, or a flyout shown at the pointer) no longer resizes when its content grows after it opens, so the content gets clipped.

What is the current behavior?

After the first arrange, PopupRoot.ArrangeSetBounds skips UpdatePosition() for pointer placement. That call is also what resizes the platform popup, so ClientSize keeps its first value.

What is the updated/expected behavior with this PR?

The popup resizes to fit its content again and stays anchored at the pointer position from when it opened, as #22366 intended. Reopening it uses the new pointer position. Behavior change: offset changes and nested pointer popups now keep the original anchor instead of jumping to the current pointer.

How was the solution implemented (if it's not obvious)?

Instead of skipping updates, Popup captures the pointer position once per open and passes it on PopupPositionRequest, and PopupPositionerExtensions.Update uses it instead of the current pointer. This also covers overlay popups, which the old check did not. The _hasInitialPosition check is removed. No public API changes.

Checklist

Breaking changes

None.

Obsoletions / Deprecations

None.

Fixed issues

Fixes #22573

The pointer position is now captured once per open and passed with the
position request, so size and offset changes go through the positioner
again without following the current pointer.
@MrJul

MrJul commented Oct 28, 2026

Copy link
Copy Markdown
Member

@cla-avalonia comment

@cla-avalonia

cla-avalonia commented Oct 28, 2026 •

Copy link
Copy Markdown
Collaborator
  • All contributors have signed the CLA.

@MrJul MrJul added bug backport-candidate-12.1.x Consider this PR for backporting to 12.1 branch regression labels Oct 28, 2026
@Om-singhaI

Copy link
Copy Markdown
Contributor Author

@cla-avalonia agree

@MrJul
MrJul enabled auto-merge October 29, 2026 18:11
@MrJul
MrJul added this pull request to the merge queue Oct 30, 2026
@github-actions

Copy link
Copy Markdown

NuGet packages

The packages for this pull request have been published (workflow run):

Merged via the queue into AvaloniaUI:main with commit 2a38dc6 Oct 30, 2026
8 checks passed
MrJul added a commit that referenced this pull request Nov 2, 2026
…ws (#22624)

* Add failing tests for popups with pointer placement not resizing

* Fix popups with pointer placement not resizing when their content grows

The pointer position is now captured once per open and passed with the
position request, so size and offset changes go through the positioner
again without following the current pointer.

---------

Co-authored-by: Julien Lebosquain <julien@lebosquain.net>
@MrJul MrJul added backported-12.1.x and removed backport-candidate-12.1.x Consider this PR for backporting to 12.1 branch labels Nov 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Popup with Pointer placement is no longer resized when its content grows (regression in 12.1.4 from #22366)

4 participants