Skip to content

Conversation

@Vignesh-SF3580
Copy link
Contributor

Issue Detail

When a page is pushed using PushModalAsync and the window is then closed, the Disappearing event for the pushed page is not triggered.

Root Cause

The Disappearing event was only triggered when the ModalStack count was zero during window closure. When pushing the page, stack count was greater than zero, which results in restricting the Disappearing event.

Description of Change

Modified the logic to trigger the Disappearing event for the last page in the stack when closing the window, which resolves the issue.

Reference:

In PopModalAsync, the Disappearing event is triggered for the LastPage in the stack. The same logic is now applied when closing the window.

Issues Fixed

Fixes #19675

Screenshots

Mac:

Before Issue Fix After Issue Fix
19675Before.mov
19675After.mov

Windows:

Before Issue Fix After Issue Fix
19675BeforeWindows.mp4
19675AfterWindows.mp4

@dotnet-policy-service dotnet-policy-service bot added the community ✨ Community Contribution label Apr 22, 2025
@dotnet-policy-service
Copy link
Contributor

Hey there @@Vignesh-SF3580! Thank you so much for your PR! Someone from the team will get assigned to your PR shortly and we'll get it reviewed.

@dotnet-policy-service dotnet-policy-service bot added the partner/syncfusion Issues / PR's with Syncfusion collaboration label Apr 22, 2025
@Vignesh-SF3580 Vignesh-SF3580 marked this pull request as ready for review April 22, 2025 13:16
Copilot AI review requested due to automatic review settings April 22, 2025 13:16
@Vignesh-SF3580 Vignesh-SF3580 requested a review from a team as a code owner April 22, 2025 13:16
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes the issue where the Disappearing event was not triggered when closing a window that contains a modal page. The changes include adding a new test case for verifying the Disappearing event on Windows and Mac, and modifying the logic in the Window class to trigger the event from the correct page.

Reviewed Changes

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

File Description
src/Controls/tests/DeviceTests/Elements/Modal/ModalTests.cs Added a new test to verify Disappearing event functionality when closing a window with a modal page.
src/Controls/src/Core/Window/Window.cs Updated the logic to trigger Disappearing on the last modal page if the ModalStack count is greater than zero.

@jsuarezruiz
Copy link
Contributor

/azp run MAUI-UITests-public

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

}
else if (Navigation.ModalStack.Count > 0)
{
Navigation.ModalStack[Navigation.ModalStack.Count - 1]?.SendDisappearing();
Copy link
Contributor

Choose a reason for hiding this comment

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

Can use Navigation.ModalStack[^1];

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@jsuarezruiz I’ve updated the code based on your suggestion. Please let me know if you have any further concerns.

@jsuarezruiz
Copy link
Contributor

/azp run MAUI-UITests-public

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

}
else if (Navigation.ModalStack.Count > 0)
{
Navigation.ModalStack[^1]?.SendDisappearing();
Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry, will require to update this for net standard 2.0:

/Users/builder/azdo/_work/1/s/src/Controls/src/Core/Window/Window.cs(439,27): error CS0518: Predefined type 'System.Index' is not defined or imported [/Users/builder/azdo/_work/1/s/src/Controls/src/Core/Controls.Core.csproj::TargetFramework=netstandard2.0]
/Users/builder/azdo/_work/1/s/src/Controls/src/Core/Window/Window.cs(439,27): error CS0656: Missing compiler required member 'System.Index..ctor' [/Users/builder/azdo/_work/1/s/src/Controls/src/Core/Controls.Core.csproj::TargetFramework=netstandard2.0]
    2 Error(s)
if (Navigation.ModalStack.Count > 0)
{
    Navigation.ModalStack[Navigation.ModalStack.Count - 1]?.SendDisappearing();
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@jsuarezruiz I’ve updated the code based on your suggestion. Please let me know if you have any further concerns.

@jsuarezruiz
Copy link
Contributor

/azp run MAUI-UITests-public

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@PureWeen PureWeen changed the base branch from main to inflight/current May 13, 2025 14:21
@PureWeen PureWeen merged commit cb4594e into dotnet:inflight/current May 13, 2025
79 checks passed
github-actions bot pushed a commit that referenced this pull request May 13, 2025
…window with a modal page (#29129)

* Fixed-19675 : Disappearing event is not triggered on modal page navigations

* Added testcase.

* updated Window.cs

* updated Window.cs
PureWeen pushed a commit that referenced this pull request May 14, 2025
…window with a modal page (#29129)

* Fixed-19675 : Disappearing event is not triggered on modal page navigations

* Added testcase.

* updated Window.cs

* updated Window.cs
PureWeen pushed a commit that referenced this pull request May 14, 2025
…window with a modal page (#29129)

* Fixed-19675 : Disappearing event is not triggered on modal page navigations

* Added testcase.

* updated Window.cs

* updated Window.cs
github-actions bot pushed a commit that referenced this pull request May 15, 2025
…window with a modal page (#29129)

* Fixed-19675 : Disappearing event is not triggered on modal page navigations

* Added testcase.

* updated Window.cs

* updated Window.cs
PureWeen added a commit that referenced this pull request May 21, 2025
For more information about inflight process check
https://github.com/dotnet/maui/wiki/Inflight-Branch-Process

# .NET MAUI Release Notes

## New Release: May 21, 2025

We're excited to announce a new release of .NET MAUI with several bug
fixes and improvements across various platforms.

### Bug Fixes

#### iOS
- **Map Control**: Fixed crash when navigating to a page containing a
map more than once (#29369)
- **CarouselView**: Fixed bounce-back behavior when Loop=false, ensuring
proper scrolling experience (#29318)
- **UIView**: Fixed NullReferenceException for UIView not being in
UIWindow (#29460)

#### Windows
- **CarouselView**: Fixed HorizontalScrollBarVisibility="Never" not
working properly (#29343)
- **UI Controls**: Fixed the color not being applied to the
Expand/Collapse Chevron icon (#29140)

#### Windows & macOS
- **Modal Navigation**: Fixed issue where Disappearing event was not
triggered when closing a window with a modal page (#29129)

#### Android
- **Modal Pages**: Improved inheritance of StatusBar and NavigationBar
background colors (#28568)
- **Footer Scrolling**: Fixed footer scrolling issues in list controls
(#29381)
- **Modal Pages**: Improved inheritance of StatusBar and NavigationBar
background colors on modal pages (#28568)

#### Cross-Platform
- **CarouselView**: Fixed ItemsLayout runtime updates to ensure proper
layout behavior (#29447)
- **CollectionView**: Fixed various issues in CollectionView
implementation (#29423)

### Testing Improvements
- Added feature matrix UITest cases for CollectionView dynamic changes
(#29424)

### Code Quality
- Fixed code formatting issues across the codebase
- Minor typo corrections (#29379)

### Contributors

This release was made possible by the hard work of our dedicated team
and community contributors. We'd like to extend our gratitude to
everyone who has contributed to this release.

### Installation

This update is available through NuGet and the .NET SDK. Update your
projects to get access to these fixes.

### Known Issues

Please refer to our issue tracker for any known issues and their
workarounds.

---

For more information about .NET MAUI, visit [the official
documentation](https://docs.microsoft.com/dotnet/maui/).
PureWeen pushed a commit that referenced this pull request May 21, 2025
…window with a modal page (#29129)

* Fixed-19675 : Disappearing event is not triggered on modal page navigations

* Added testcase.

* updated Window.cs

* updated Window.cs
@github-actions github-actions bot locked and limited conversation to collaborators Jun 13, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-controls-modal community ✨ Community Contribution partner/syncfusion Issues / PR's with Syncfusion collaboration platform/windows

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Win: Disappearing event is not be occurred on the modal page when the second window close

3 participants