Skip to content

fix: light dismiss behavior fails when opened from the ContextMenu. - #22037

Merged
grokys merged 3 commits into
AvaloniaUI:mainfrom
Linlccc:fix-popup-light-dismiss
Aug 27, 2026
Merged

grokys merged 3 commits into
AvaloniaUI:mainfrom
Linlccc:fix-popup-light-dismiss

Conversation

@Linlccc

@Linlccc Linlccc commented Aug 22, 2026

Copy link
Copy Markdown
Contributor

What does the pull request do?

Fixed an issue where the light dismiss behavior failed to work when a popup was opened from a context menu.

What is the current behavior?

Light dismiss failed when a popup was opened from a context menu.

What is the updated/expected behavior with this PR?

Light dismiss works when a popup is opened from a context menu.

Checklist

  • Added unit tests (if possible)?

Fixed issues

Fixes #22036

@avaloniaui-bot

Copy link
Copy Markdown

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

@cla-avalonia

cla-avalonia commented Aug 22, 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 labels Aug 24, 2026
@Linlccc

Linlccc commented Aug 24, 2026

Copy link
Copy Markdown
Contributor Author

@cla-avalonia agree

@grokys grokys self-assigned this Aug 27, 2026
@grokys
grokys requested a balanced review from Copilot August 27, 2026 10:54

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes light-dismiss state when overlapping popups close out of opening order.

Changes:

  • Tracks active light-dismiss registrations.
  • Preserves overlay visibility and pass-through state for remaining popups.
  • Adds regression coverage for sequential popup closure.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
src/Avalonia.Controls/Primitives/LightDismissOverlayLayer.cs Adds registration-based overlay state management.
src/Avalonia.Controls/Primitives/Popup.cs Registers each light-dismiss popup with the overlay.
tests/Avalonia.Controls.UnitTests/Primitives/PopupTests.cs Tests closing an earlier popup without affecting the next.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@grokys grokys left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM in general, just a few nits - feel free to push back on them if you don't think they're valid - it's an internal control with few consumers after all ;)

Comment thread src/Avalonia.Controls/Primitives/LightDismissOverlayLayer.cs Outdated
Comment thread src/Avalonia.Controls/Primitives/LightDismissOverlayLayer.cs Outdated
Comment thread src/Avalonia.Controls/Primitives/LightDismissOverlayLayer.cs
2. Eliminate misinformation that Registration may bring.
3. Remove LightDismissOverlayLayer Manually set IsVisible to false at creation time.
@avaloniaui-bot

Copy link
Copy Markdown

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

@grokys
grokys enabled auto-merge August 27, 2026 16:07
@grokys
grokys added this pull request to the merge queue Aug 27, 2026
@avaloniaui-bot

Copy link
Copy Markdown

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

Merged via the queue into AvaloniaUI:main with commit 6b185ed Aug 27, 2026
10 checks passed
@Linlccc
Linlccc deleted the fix-popup-light-dismiss branch September 1, 2026 01:02
MrJul pushed a commit to MrJul/Avalonia that referenced this pull request Sep 2, 2026
…valoniaUI#22037)

* fix: light dismiss behavior fails when opened from the ContextMenu.

* 1. LightDismissOverlayLayer is invisible by default.
2. Eliminate misinformation that Registration may bring.
3. Remove LightDismissOverlayLayer Manually set IsVisible to false at creation time.

---------

Co-authored-by: Steven Kirk 
@MrJul MrJul added backported-12.1.x and removed backport-candidate-12.1.x Consider this PR for backporting to 12.1 branch labels Sep 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 IsLightDismissEnabled stops working when the Popup is opened from a ContextMenu

6 participants