Skip to content

Implement TopLevel.OpenedPopups - #22074

Merged
MrJul merged 6 commits into
mainfrom
feature/open-popups-list
Aug 26, 2026
Merged

MrJul merged 6 commits into
mainfrom
feature/open-popups-list

Conversation

@maxkatz6

@maxkatz6 maxkatz6 commented Aug 26, 2026 •

Copy link
Copy Markdown
Member

What does the pull request do?

This PR adds new API to access Popups opened on the specific TopLevel target.

public class TopLevel
{
+    IReadOnlyList<Popup> OpenedPopups { get; }
}
public class Popup
{
+    IReadOnlyList<Popup> OpenedPopups { get; }
}

public class static HeadlessWindowExtensions
{
-    public static IReadOnlyList<TopLevel> GetOpenPopups(this TopLevel topLevel);
}

Important implementation details to mention:

  1. Property returned a new collection on each call, similarly to Window.OwnedWindows property.
  2. Returned value doesn't implement INCC, instead Popup.IsOpenProperty callbacks are recommended.
  3. This API returns list of Popup, unlikely removed API from #21889 that returned list of top levels. List of top levels is not applicable with overlay popups, and it's generally confusing to get TopLevel when you ask for Popups. But at the same time Popup is a bit less useful in headless testing, so it now requires an extra helper to resolve top level from a popup (if present).

Checklist

Breaking changes

Breaking change between nightly builds - removed API.

Fixed issues

Fixes #8403
And replaces new API from #21889

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@MrJul MrJul added this to the 12.2 milestone Aug 26, 2026
@robloo

robloo commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

How does this take into account Flyouts?

@maxkatz6

Copy link
Copy Markdown
Member Author

@robloo current flyouts are implemented with Popups, as well as ToolTips. This new API will return backing popups for both of them.

kekekeks
kekekeks previously approved these changes Aug 26, 2026
@avaloniaui-bot

Copy link
Copy Markdown

You can test this PR using the following package version. 12.2.999-cibuild0068940-alpha. (feed url: https://nuget-feed-all.avaloniaui.net/v3/index.json) [PRBUILDID]

@MrJul
MrJul added this pull request to the merge queue Aug 26, 2026
Merged via the queue into main with commit 97dd785 Aug 26, 2026
9 checks passed
@MrJul
MrJul deleted the feature/open-popups-list branch August 26, 2026 22:45
@MrJul MrJul added the backport-candidate-12.1.x Consider this PR for backporting to 12.1 branch label Sep 17, 2026
@MrJul MrJul removed this from the 12.2 milestone Sep 17, 2026
@kekekeks kekekeks added backported-12.1.x and removed backport-candidate-12.1.x Consider this PR for backporting to 12.1 branch labels Sep 21, 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.

Port GetOpenPopups(Window) from UWP

5 participants