Skip to content

[Animations] Page transitions, a composable navigation-transition hook and shared elements - #40537

Merged
kubaflo merged 18 commits into
dotnet:mainfrom
aritchie:feature/page-transitions
Nov 25, 2026
Merged

kubaflo merged 18 commits into
dotnet:mainfrom
aritchie:feature/page-transitions

Conversation

@aritchie

Copy link
Copy Markdown
Contributor

Target Branch

This PR is for Initial base
New features, API changes, or .NET 12 work (including .NET 12 fixes) main

Description of Change

This implements phase 4a (built-in page transitions and the navigation hook they're built on) and the shared elements of phase 4b from #40382, using the spec's names. It doesn't depend on the storyboard PR; StoryboardTransition follows once that lands. It is based on Shiny page transitions, rebuilt on MAUI's navigation managers instead of replacement renderers and wrapped delegates.

API (Microsoft.Maui.Controls.Animations)

  • Transition types: PageTransition is a closed hierarchy.
    • Platform and None are shared values that can't be changed.
    • Each transition has Duration (300 ms by default), Easing and Background.
    • The subclasses are FadeTransition, SlideTransition (From takes a SlideEdge: Start, End, Top or Bottom, with Start and End following FlowDirection) and ScaleTransition (FromScale).
    • A type converter accepts Platform, None, Fade, SlideFromEnd, SlideFromStart, SlideFromTop, SlideFromBottom and Scale.
  • PageTransitions: the attached properties Transition, ModalTransition and TabTransition, and extension overloads for PushAsync, PopAsync, PushModalAsync, PopModalAsync, GoToAsync and Window.ReplacePageAsync. INavigation and Shell gain no members, and existing calls bind exactly as before.
  • SharedTransition: attached Name and Group.
  • Navigation hook: INavigationTransitionProvider replaces renderer subclassing.
    • Providers are registered through DI and consulted in order. Each one can handle a navigation, decline it, or suppress its animation.
    • Each provider receives a NavigationTransitionRequest (kind, both pages, the resolved transition, back or forward, interactive or not, flow direction) and returns a PlatformNavigationTransition, which wraps an iOS animator and interaction controller, an Android Animation, or a Windows NavigationTransitionInfo.
    • MAUI's own presets are the last provider.
    • The existing virtual overrides (Android OnCreateNavigationAnimation, Windows GetNavigationTransition) still take precedence.

Which transition runs

  1. An explicit "don't animate" (animated: false) means None.
  2. Then a per-navigation argument.
  3. Then the attached property on the page being shown.
  4. Then the nearest ancestor that sets it: NavigationPage, Shell or Window.
  5. Otherwise Platform.

Going back reverses the transition that actually ran, which is recorded on the navigation entry, unless the PopAsync passes one of its own. Reduced motion turns every transition except Platform into None, and Platform leaves reduced motion to the OS.

Platforms

  • iOS and Mac Catalyst:
    • UIViewControllerAnimatedTransitioning for NavigationPage and for both Shell paths (the renderer and the handler).
    • The edge swipe-back keeps following the finger with presets and with a provider's interaction controller.
    • Modals go through the transitioning delegate, presented over the page underneath unless the page sets its own presentation style.
    • Shell tab switches (renderer) and ReplacePageAsync animate.
    • Shared elements fly as snapshots inside the transition context.
  • Android:
    • Fragment animations for NavigationPage and the default Shell handler.
    • Modal transitions replace the hard-wired slide-up.
    • ReplacePageAsync animates through the window overlay.
    • Shared elements fly in the decor overlay.
  • Windows:
    • Presets map to the nearest NavigationTransitionInfo (Slide, DrillIn, Entrance, Suppress), so Duration and Easing aren't honored there yet.

Known gaps (open for discussion)

  • Not wired: the Android compat ShellRenderer, and the legacy iOS NavigationRenderer.
  • Shell tabs: not wired on Android, on iOS's opt-in ShellHandler, on TabbedPage or on Windows.
  • Gestures: interactive Android predictive back (open question Q5).
  • Windows: the two-presenter Composition host, which Duration, Easing, Fade and Scale need. Modals, tabs and root replacement aren't wired either.
  • Modals: shared elements don't fly during modal navigation.

Tests

  • Controls.Core.UnitTests/Animations: 89 tests, covering the resolution order, back reversing what ran (including one-off overrides), the provider chain (handle, decline, suppress, order, virtuals winning), the converter strings, RTL slide edges, overload binding, shared-element pairing and Group disambiguation with the missing-match fallback, reduced motion, and completion after the transition.
  • Xaml.UnitTests (PageTransitionsXaml): 10 tests under Runtime, XamlC and SourceGen.
  • Controls.DeviceTests (PageTransitions): 9 tests, all passing on an Android API 37 emulator. iOS, Mac Catalyst and Windows weren't run locally.
  • UI test: Issue6, a HostApp page and an NUnit test. It builds; it hasn't been run locally (no Appium).
  • The tests fail without the code: each of these changes to the resolver, re-run against the suite, fails tests:
    • ignoring the per-call argument (6),
    • ignoring the recorded pop (4),
    • skipping the providers (6),
    • dropping reduced motion (2),
    • skipping the ancestor walk (2).

Notes

This PR shares two hunks with the storyboard PR: the animations XmlnsDefinition and the XamlC EasingTypeConverter fix. Whichever merges second drops them.

Issues Fixed

Contributes to #6 and #40382 (phases 4a and 4b, shared elements).

…gation-transition providers and shared elements

Adds the page-transition API from the animations spec (dotnet#40382, Part G):
PageTransition (Platform, None) with FadeTransition, SlideTransition and ScaleTransition,
the PageTransitions attached properties and per-navigation overloads, SharedTransition,
and INavigationTransitionProvider, a provider chain consulted from the base navigation
virtuals so existing overrides keep precedence. Back navigation reverses the transition
that ran. iOS/Mac Catalyst, Android and Windows navigation managers resolve transitions
through an internal hook; presets run on the platform's navigation animation machinery.
…mlC Easing converter

The XamlC compiled Easing converter looked the Easing type up in the Controls
assembly, but Easing lives in Microsoft.Maui, so any Easing-typed property set
from XAML failed to compile under XamlC with 'Value cannot be null'.
Copilot AI balanced review requested due to automatic review settings November 23, 2026 18:11
@github-actions

Copy link
Copy Markdown
Contributor

🚀 Dogfood this PR with:

⚠️ WARNING: Do not do this without first carefully reviewing the code of this PR to satisfy yourself it is safe.

curl -fsSL https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.sh | bash -s -- 40537

Or

  • Run remotely in PowerShell:
iex "& { $(irm https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.ps1) } 40537"

@azure-pipelines

This comment has been minimized.

@dotnet-policy-service

Copy link
Copy Markdown
Contributor

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

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.

🟡 Changes recommended

Overlapping Android root replacements can reset an in-progress animation and make the new root jump, while additional transition-handling and test defects remain unresolved.

11 open issues
What changed in this PR

Adds page-transition presets, a composable navigation-transition provider hook, and shared-element animations to .NET MAUI, advancing phases 4a/4b of #40382 and the navigation scenarios in #6. Platform integration is incremental, with Windows and legacy-handler limitations documented in the PR.

Changes:

  • Introduces transition APIs, attached properties, per-navigation overloads, and shared-element pairing.
  • Connects native navigation, modal, tab, and root-replacement paths to transition handling on supported platforms.
  • Adds unit, XAML, device, and UI tests, and corrects compiled XAML easing resolution.
File Description
src/​Core/​src/​Platform/​Windows/​StackNavigationManager.cs Consults transition hooks for Windows stack navigation.
src/​Core/​src/​Platform/​NavigationTransitionHooks.cs Defines the internal Core-to-Controls transition contract.
src/​Core/​src/​Platform/​iOS/​NavigationTransitionDriver.cs Supplies native animators and drives interactive edge pops.
src/​Core/​src/​Platform/​iOS/​NavigationControllerManager/​NavigationControllerManager.cs Connects navigation delegates to the transition driver.
src/​Core/​src/​Platform/​iOS/​NavigationControllerManager/​INavigationManagerDelegate.cs Exposes navigation ownership and controller-to-page lookup.
src/​Core/​src/​Platform/​Android/​Navigation/​StackNavigationManager.cs Prepares transitions and supplies fragment animations.
src/​Core/​src/​Handlers/​NavigationPage/​NavigationViewHandler.iOS.cs Maps navigation controllers back to MAUI views.
src/​Controls/​tests/​Xaml.UnitTests/​PageTransitionsXaml.xaml.cs Tests transition inflation, conversion, and source generation.
src/​Controls/​tests/​Xaml.UnitTests/​PageTransitionsXaml.xaml Defines declarative transition test cases.
src/​Controls/​tests/​TestCases.Shared.Tests/​Tests/​Issues/​Issue6.cs Checks shared-element navigation and final layout.
src/​Controls/​tests/​TestCases.HostApp/​Issues/​Issue6.cs Provides the shared-element list/detail test pages.
src/​Controls/​tests/​DeviceTests/​TestCategory.cs Adds the PageTransitions test category.
src/​Controls/​tests/​DeviceTests/​Elements/​PageTransitions/​PageTransitionsTests.cs Exercises native navigation, providers, timing, and cleanup.
src/​Controls/​tests/​Core.UnitTests/​Animations/​SharedTransitionTests.cs Tests name/group pairing and visibility filtering.
src/​Controls/​tests/​Core.UnitTests/​Animations/​PageTransitionTestHelpers.cs Adds recording providers and a controllable navigation handler.
src/​Controls/​tests/​Core.UnitTests/​Animations/​PageTransitionCurvesTests.cs Tests transition geometry, reversal, easing, and RTL behavior.
src/​Controls/​tests/​Core.UnitTests/​Animations/​NavigationTransitionProviderTests.cs Tests provider ordering, suppression, and built-in fallback.
src/​Controls/​src/​Core/​PublicAPI/​netstandard/​PublicAPI.Unshipped.txt Records the shared transition API surface.
src/​Controls/​src/​Core/​PublicAPI/​net/​PublicAPI.Unshipped.txt Records the shared .NET transition APIs.
src/​Controls/​src/​Core/​PublicAPI/​net-windows/​PublicAPI.Unshipped.txt Records APIs including the WinUI transition constructor.
src/​Controls/​src/​Core/​PublicAPI/​net-maccatalyst/​PublicAPI.Unshipped.txt Records APIs including native Apple transition construction.
src/​Controls/​src/​Core/​PublicAPI/​net-ios/​PublicAPI.Unshipped.txt Records APIs including UIKit animator and interaction support.
src/​Controls/​src/​Core/​PublicAPI/​net-android/​PublicAPI.Unshipped.txt Records APIs including Android animation factories.
src/​Controls/​src/​Core/​Properties/​AssemblyInfo.cs Registers the animations XAML namespace.
src/​Controls/​src/​Core/​Platform/​ModalNavigationManager/​ModalNavigationManager.iOS.cs Resolves transitions before modal presentation and dismissal.
src/​Controls/​src/​Core/​Platform/​ModalNavigationManager/​ModalNavigationManager.Android.cs Supports custom modal entrance and exit animations.
src/​Controls/​src/​Core/​Hosting/​AppHostBuilderExtensions.cs Installs Controls navigation-transition hooks.
src/​Controls/​src/​Core/​Handlers/​Shell/​ShellSectionHandler.iOS.cs Supplies Shell page lookup for transition requests.
src/​Controls/​src/​Core/​Compatibility/​Handlers/​Shell/​iOS/​ShellSectionRenderer.cs Integrates transitions into renderer-based Shell navigation.
src/​Controls/​src/​Core/​Compatibility/​Handlers/​Shell/​iOS/​ShellItemRenderer.cs Requests animators for Shell tab switches.
src/​Controls/​src/​Core/​Animations/​TabPageTransitions.iOS.cs Resolves Apple Shell tab transitions.
src/​Controls/​src/​Core/​Animations/​SharedTransition.cs Defines shared-element metadata and pairing rules.
src/​Controls/​src/​Core/​Animations/​RootPageTransition.iOS.cs Animates root replacement using a window snapshot.
src/​Controls/​src/​Core/​Animations/​RootPageTransition.cs Coordinates root-transition resolution and platform dispatch.
src/​Controls/​src/​Core/​Animations/​RootPageTransition.Android.cs Animates root replacement through the decor overlay.
src/​Controls/​src/​Core/​Animations/​PlatformNavigationTransition.Windows.cs Wraps WinUI navigation-transition information.
src/​Controls/​src/​Core/​Animations/​PlatformNavigationTransition.iOS.cs Wraps UIKit animators, interaction, and suppression.
src/​Controls/​src/​Core/​Animations/​PlatformNavigationTransition.Android.cs Wraps per-side Android animation factories.
src/​Controls/​src/​Core/​Animations/​PageTransitions.cs Adds attached properties and navigation extension overloads.
src/​Controls/​src/​Core/​Animations/​PageTransitionCurves.cs Implements shared transition geometry and easing.
src/​Controls/​src/​Core/​Animations/​PageTransitionAnimator.iOS.cs Implements UIKit presets and shared-element snapshot flights.
src/​Controls/​src/​Core/​Animations/​PageTransitionAnimations.Android.cs Implements fragment presets and overlay snapshot flights.
src/​Controls/​src/​Core/​Animations/​PageTransition.cs Defines presets, configuration, snapshots, and string conversion.
src/​Controls/​src/​Core/​Animations/​NavigationTransitionProvider.cs Defines provider requests and platform transition results.
src/​Controls/​src/​Core/​Animations/​ModalPageTransitions.iOS.cs Configures modal transitioning delegates.
src/​Controls/​src/​Core/​Animations/​ControlsNavigationTransitionHooks.Windows.cs Maps presets to WinUI and reads animation preferences.
src/​Controls/​src/​Core/​Animations/​ControlsNavigationTransitionHooks.Standard.cs Supplies the non-platform reduced-motion fallback.
src/​Controls/​src/​Core/​Animations/​ControlsNavigationTransitionHooks.iOS.cs Resolves UIKit animators and reads Reduce Motion.
src/​Controls/​src/​Core/​Animations/​ControlsNavigationTransitionHooks.cs Installs hooks and selects built-in platform transitions.
src/​Controls/​src/​Core/​Animations/​ControlsNavigationTransitionHooks.Android.cs Resolves fragment animations and reads reduced-motion settings.
src/​Controls/​src/​Build.Tasks/​CompiledConverters/​EasingTypeConverter.cs Resolves Easing from the correct Core assembly.

Review effort: Balanced

Comment on lines +23 to +24
var hero = App.WaitForElement("DetailTile").GetRect();
Assert.That(hero.Height, Is.EqualTo(240).Within(2), "The shared element should be laid out at its own size once it lands, not at the source's.");

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Addressed in 3e04ea4 with a device test instead: the snapshots are native views with no automation ids, so Appium can't see them mid-flight. The device test samples the native alpha during a one-second flight (source hidden, then both restored) and fails with the Android flight disabled. A cancelled iOS pop isn't covered yet; it can't run on the machine this was built on.

@kubaflo

kubaflo commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

/review expert-review-with-gate

@github-actions github-actions Bot added the s/agent-review-in-progress AI review is currently running for this PR label Nov 23, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Warning

Your /review gate couldn't start due to a transient error triggering the pipeline. The command was left unacknowledged so scheduled recovery can retry it automatically; you can also comment /review gate again in a minute.

@github-actions github-actions Bot removed the s/agent-review-in-progress AI review is currently running for this PR label Nov 23, 2026
- Annotate the ConditionalWeakTable helper's TValue for trimming (IL2091 under NativeAOT).
- Scope per-navigation arguments to the page and navigation kind they were staged for,
  never stage a pop of the root page, and clear an unconsumed argument when the
  navigation ends without clobbering a newer one.
- Record the flow direction a page was shown in and reuse it when going back.
- Reject infinite and NaN FromScale values.
- No shared-element flights under reduced motion; the platform transition is kept.
- Root replacement is outside the provider contract; overlapping ReplacePageAsync
  calls on a window finish the running one first.
- iOS Shell: find a popped page through the retained trackers.
- iOS: drive the interactive pop from the edge or the iOS 26 content swipe-back.
- Tests: kind scoping, flow direction on pop, FromScale, reduced-motion heroes;
  modal device test skipped on Windows; UI test compares sizes as a ratio.

@github-actions github-actions Bot 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.

Expert Review — 15 findings

Reviewed commit dbbd1a4.

Source assessment incomplete (17/21 dimensions); finding count is partial.

See inline comments for details.

}

// A page being popped is often already detached from its section.
if (Shell.Current is { } active && s_shellOverrides.TryGetValue(active, out var activeEntry))

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.

[critical] Logic and Correctness Verification - Every ordinary NavigationPage push/pop now evaluates Shell.Current while looking for an override. With two windows whose roots are NavigationPages, Shell.Current throws InvalidOperationException because no Shell can be selected, so previously working navigation fails even without opting into transitions. With a Shell in another window, this fallback can instead apply that Shell's deferred GoToAsync override to an unrelated NavigationPage and record the wrong transition for its later pop. Resolve the owning Shell from the supplied navigation/pages rather than consulting the global accessor. Add non-Shell multi-window and unrelated-window regression cases.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in 250a4fb. A regression test covers it.

if (element is ShellSection section)
return (section.CurrentItem as IShellContentController)?.Page;

return element as Page;

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.

[major] Logic and Correctness Verification - ShellSection.OnPopAsync removes the outgoing page from its logical stack before invoking the native pop. ElementForViewController searches that shortened stack, so this returns null for the outgoing controller. A detail pushed with a one-off SlideTransition therefore pops with Platform instead of reversing the recorded slide; per-pop overrides and shared-element return pairing are also lost. Use the retained controller trackers as a fallback here and in ShellSectionHandler.iOS.cs:426. The new Shell device test expects the slide on pop.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in 9127534 (same issue as the matching Copilot comment).

return null;
}

var isInteractive = operation == UINavigationControllerOperation.Pop

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.

[major] Logic and Correctness Verification - NavigationControllerManager.SetupInteractivePopGesture enables InteractiveContentPopGestureRecognizer on iOS/Mac Catalyst 26+, but this driver observes only the edge recognizer. A back swipe starting inside a page with a preset resolves IsInteractive=false and returns an animator without an interaction controller: the pop runs on a timer instead of following the finger and allowing cancellation. Observe both recognizers and drive progress from the one initiating the pop. The added programmatic-navigation tests do not cover this gesture.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in 9127534 (same issue as the matching Copilot comment).

internal static PageTransition? GetEffectiveTransition(NavigationTransitionRequest request, out List<(VisualElement From, VisualElement To)> heroes)
{
var transition = request.Transition;
heroes = request.Kind is NavigationTransitionKind.Push or NavigationTransitionKind.Pop

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.

[major] Logic and Correctness Verification - With reduced motion enabled and only matching SharedTransition.Name values set, the resolver leaves the requested transition as Platform. This still collects heroes and substitutes a FadeTransition, so Android/iOS/Mac Catalyst fly snapshots despite the documented 'nothing morphs' contract. Skip hero pairing under reduced motion before converting Platform into a custom transition. SharedElementsDontFlyUnderReducedMotion sets an explicit SlideTransition, which becomes None and cannot detect this case.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in 9127534 (same issue as the matching Copilot comment).

// An unanimated navigation is never asked for a transition, so None leaves nothing pending.
if (!transition.IsNone)
{
PageTransitionResolver.SetPendingForward(page, transition);

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.

[major] Logic and Correctness Verification - The page-keyed pending override survives navigation that never reaches the resolver. Push an already-stacked detail with a FadeTransition: NavigationPage.OnPushAsync returns immediately, leaving the Fade pending. Pop it and push it normally, and the old Fade overrides its current attached transition. Cancelled Shell pushes and unwired Windows modal requests can similarly retain values, and modal/stack forward requests share the same table. Scope overrides to the operation and clear unconsumed entries on completion/failure using a token that cannot remove a newer request. The successful-push reuse test does not exercise these paths.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in 9127534 (same issue as the matching Copilot comment).

await shell.GoToAsync(state, animate).ConfigureAwait(true);
}
else
{

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.

[major] Input and Path Correctness - Caller-supplied ShellNavigationQueryParameters are forwarded through Shell.GoToAsync's IDictionary overload here. That overload constructs ShellRouteParameters without its single-use tracking, so ShellContent.ApplyQueryAttributes cannot remove the delivered objects and a later back navigation reapplies them. For example, navigate to a detail with single-use parameters and a transition, push another page, change the detail's parameter-backed state, then navigate back: the old values overwrite that state again. Preserve the ShellNavigationQueryParameters type when selecting the forwarding overload so parameters remain limited to the requested navigation.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in 250a4fb. A regression test covers it.

: NavigationTransitionKind.Push;

// UIKit only asks for an animator when the navigation is animated.
var resolved = PageTransitionResolver.Resolve(kind, from as Page, to as Page, animated: true, isInteractive);

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.

[moderate] Cross-Platform Behavioral Consistency - UIKit does not request an animator for an unanimated push, so this is not called and the shown transition is not recorded on iOS/Mac Catalyst. Push a fresh detail with an attached FadeTransition using animated:false, change its attached transition to SlideTransition, then pop with animation: iOS uses Slide, whereas Android/Windows resolve the unanimated push and retain the Fade snapshot. A reused page can instead retain an older push's snapshot. Record forward resolution for unanimated pushes too; the shared recording-handler test does not model this missing native callback.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in 250a4fb. A regression test covers it.

ThrowIfFrozen();
if (double.IsNaN(value) || value < 0)
{
throw new ArgumentOutOfRangeException(nameof(value), value, "FromScale must be zero or greater.");

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.

[moderate] Logic and Correctness Verification - FromScale accepts double.PositiveInfinity. GetPose then evaluates infinity + (1 - infinity) * progress, producing NaN even at progress zero and one, which reaches Android/iOS scale matrices instead of valid geometry. Reject non-finite scales as well as negative values and add an infinity case to the validation test.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in 9127534 (same issue as the matching Copilot comment).

AssertPageAtRest(root);
});

Assert.Equal(NavigationTransitionKind.PushModal, _requests[0].Kind);

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.

[moderate] Logic and Correctness Verification - ModalPresentAndDismissComplete runs on Windows, but that platform's modal manager never calls PageTransitionResolver or the registered provider. With this ContentPage-root fixture, _requests stays empty and indexing _requests[0] fails even when both modal operations succeed. Restrict the feature-specific provider assertions to wired platforms or add a separate Windows fallback assertion while modal transitions remain staged.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in 9127534 (same issue as the matching Copilot comment).

// NavigatedTo is raised once the transition has finished, so this text means the flight is over.
Assert.That(App.WaitForTextToBePresentInElement("DetailStatus", "Arrived at 2"), Is.True);
var hero = App.WaitForElement("DetailTile").GetRect();
Assert.That(hero.Height, Is.EqualTo(240).Within(2), "The shared element should be laid out at its own size once it lands, not at the source's.");

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.

[moderate] Logic and Correctness Verification - GetRect forwards the native Appium rectangle without density conversion. Android reports physical pixels, whereas DetailTile.HeightRequest=240 uses device-independent units. At density 2, a correctly laid-out tile is about 480 pixels tall and fails this assertion. Normalize the Android height with App.GetDisplayDensity() before comparing it with the requested logical height.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in 9127534 (same issue as the matching Copilot comment).

Copilot AI balanced review requested due to automatic review settings November 23, 2026 19:49

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.

🔵 Needs a closer look

Unresolved issues leave iOS transition state stale after unanimated pushes, expose the window background during root replacements, and allow overlapping Shell calls to overwrite per-navigation transitions.

3 open issues
4 previously missed issues

In code that hasn't changed since last review

Medium severity Record transitions for unanimated iOS and Catalyst pushes

src/​Controls/​src/​Core/​Animations/​ControlsNavigationTransitionHooks.iOS.cs:21

On iOS and Mac Catalyst, an unanimated push skips this callback and leaves the recorded transition and flow direction stale. If a page is pushed with Fade, popped, then reused with Slide and animated: false, its next animated pop still uses the old Fade snapshot. Resolve and record every push at the navigation-request boundary, including unanimated pushes, and let this callback consume the prepared result without resolving it again.

Medium severity Keep incoming root opaque during Fade and Scale replacements

src/​Controls/​src/​Core/​Animations/​PageTransitionCurves.cs:125

During root replacement, Fade makes the incoming root partly transparent while fading the outgoing snapshot above it, exposing the window background: at halfway, two opaque white pages over black render at only 75% white. Scale has the same unwanted transparency where the two pages overlap. Keep the incoming root opaque while preserving its translation and scale, and fade only the outgoing snapshot.

Medium severity Scope transition overrides to individual navigation operations

src/​Controls/​src/​Core/​Animations/​PageTransitions.cs:165

The override is stored once per Shell, so an overlapping call can replace the transition of a navigation that is still waiting or deferred. If the newer call fails and removes its override, the earlier call also loses its per-navigation transition; otherwise it can use the newer call's transition. Associate the override with the individual navigation operation, or serialize these overloads before installing it.

Low severity Test shared-element flights during and after transitions

src/​Controls/​src/​Core/​Animations/​ControlsNavigationTransitionHooks.cs:72

No added test asserts that the native shared-element flight actually runs. SharedTransitionTests verifies pairing only, the device tests use untagged labels, and Issue6 checks final rectangles and navigation status, which remain correct if HeroFlight.Prepare/HeroFlights.Start is skipped entirely. Add a device test that observes snapshots and hidden real elements during the transition, then checks native opacity and overlay cleanup after completion and a cancelled iOS pop.

8 resolved since last review

Review effort: Balanced

@kubaflo

kubaflo commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

/review expert-review

- Never consult Shell.Current: only a Shell that owns the page (or the destination
  page) can supply a GoToAsync override, so several NavigationPage windows don't throw
  and another window's Shell can't leak its override.
- Android shared elements fly in the overlay of the window the pages are in (a modal
  dialog's included), keep the observer they subscribed to, and put the pictures and
  hidden sources back if the window goes away before the flight starts.
- GoToAsync(state, transition, parameters) keeps ShellNavigationQueryParameters single-use.
- iOS/Mac Catalyst: resolve and record unanimated pushes and pops, which UIKit never
  asks an animator for, so going back reverses what the page was shown with.
- Tests: multi-window and unrelated-window resolution, single-use parameters with a
  transition, unanimated push recording (device), and assertions on the resolved
  transition rather than the platform result.
Copilot AI balanced review requested due to automatic review settings November 23, 2026 20:24
@kubaflo

kubaflo commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

/review run-tests

@github-actions

This comment has been minimized.

… state, request scopes, More-tab navigation

Native state a transition captures vs later managed writes
- ManagedViewState: after a transition puts back the native state it captured, every managed value that changed
  meanwhile (Opacity, IsVisible, the transform properties) is mapped again through the element's handler. Used by
  the iOS root replacement and the iOS push/pop animator, so a binding that changes the incoming page's Opacity or
  translation mid-transition is no longer overwritten.
- Shared elements are hidden through native visibility (UIView.Hidden, View.Visibility) instead of alpha on iOS and
  Android, so an Opacity change during the flight can't reveal the real element under its snapshot; landing puts
  the captured visibility back, or maps IsVisible again if it changed.
- The iOS root replacement removes only the animations it added to the incoming root, never the root's own.

Shell request scopes
- Every Shell request has a scope: one without a transition masks an enclosing request's, so a GoToAsync started
  from another's Navigated handler no longer takes (or stages) that request's transition.
- The request's scopes are carried explicitly across the dispatches in ShellNavigationManager, as Android's
  dispatcher posts a bare callback that doesn't flow the execution context.

Root replacement ordering
- A replacement queued behind another assignment (started from Window.PropertyChanging) ignores that earlier
  assignment finishing, and waits for its own page to land before animating.

iOS Shell More tab (opt-in handler)
- Push, pop and pop-to-root on the More controller go through one path: unanimated ones are reported to the
  transition hooks (so PushAsync(page, None) is recorded for the pop), and pop-to-root waits for a running
  transition before completing and disposing pages.
- The More delegate maps view controllers through the section's root-aware mapping, so a shared element on the
  overflow section's root flies.

Windows
- A preset navigation no longer walks the pages for shared elements WinUI doesn't fly.

Tests
- Unit: request masking, the dispatch boundary, queued root replacements, Windows hero discovery, deferred modal
  presentation and dismissal replaying their saved transitions, ManagedViewState.
- Device (compiled): opacity during a flight, iOS overlapping and queued root replacements, opacity and own
  animations kept across a root replacement, hero snapshots removed on completion and cancellation, and More-tab
  completion, Platform timing, unanimated recording and root heroes under both iOS Shell implementations.
@kubaflo

kubaflo commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

/review run-tests

@github-actions

github-actions Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Selected Tests

@kubaflo — AI-selected UI tests and device tests (GPT-6.2 Sol + MAI Code 2) for commit 8c0a324a.

Result FAILED Platforms Android, iOS, MacCatalyst, Windows Tests 5 UI, 7 device Commit 8c0a324a


🧪 Test selection — click to expand
Suite Result Selected Build
UI tests ❌ failed 5 of 77 categories maui-pr-uitests #1698117
Device tests ✅ passed 7 of 104 units maui-pr-devicetests #1698123
🧪 UI tests — Lifecycle, Navigation, Shell1, Shell2 +1 on Android, iOS, MacCatalyst, Windows

❌ maui-pr-uitests #1698117 failed — 1 test failed on Windows. See Failed tests below.

GPT-6.2 Sol: Run targeted UI coverage for page transitions, Shell routing, modal navigation, and window root replacement on all four platforms.
MAI Code 2: Cross-platform page-transition feature; run Navigation, Shell, and Window UI coverage on all four platforms.

🧪 Ran — 5 categories on Android, iOS, MacCatalyst, Windows

Platform Categories
Android Lifecycle, Navigation, Shell1, Shell2
iOS Lifecycle, Navigation, Shell1, Shell2, Window
MacCatalyst Lifecycle, Navigation, Shell1, Shell2, Window
Windows Lifecycle, Navigation, Shell1, Shell2, Window
📊 Results — failed: 22 passed, 1 failed of 23 jobs

❌ Failed tests (1)

Test Failed on Error
Issue6.SharedElementLandsAndSourceIsRestoredAfterPop Windows The shared element should be laid out at its own size once it lands, not at the source's.

🔗 All test results · Build logs

Job Result
WinUI UITests Controls Navigation ❌ failed
Android UITests CoreClr Controls (API 30) Lifecycle ✅ succeeded
Android UITests CoreClr Controls (API 30) Navigation ✅ succeeded
Android UITests CoreClr Controls (API 30) Shell1 ✅ succeeded
Android UITests CoreClr Controls (API 30) Shell2 ✅ succeeded
Android UITests Shell Renderer Controls Shell Renderer (API 30) Shell1 ✅ succeeded
Android UITests Shell Renderer Controls Shell Renderer (API 30) Shell2 ✅ succeeded
Build UITests CoreCLR Sample App Build Sample App ✅ succeeded
Build UITests Windows Sample App Build Sample App (Windows) ✅ succeeded
iOS UITests CoreCLR Controls (vlatest) Lifecycle ✅ succeeded
iOS UITests CoreCLR Controls (vlatest) Navigation ✅ succeeded
iOS UITests CoreCLR Controls (vlatest) Shell1 ✅ succeeded
iOS UITests CoreCLR Controls (vlatest) Shell2 ✅ succeeded
iOS UITests CoreCLR Controls (vlatest) Window ✅ succeeded
MacCatalyst UITests CoreCLR Controls Lifecycle ✅ succeeded
MacCatalyst UITests CoreCLR Controls Navigation ✅ succeeded
MacCatalyst UITests CoreCLR Controls Shell1 ✅ succeeded
MacCatalyst UITests CoreCLR Controls Shell2 ✅ succeeded
MacCatalyst UITests CoreCLR Controls Window ✅ succeeded
WinUI UITests Controls Lifecycle ✅ succeeded
WinUI UITests Controls Shell1 ✅ succeeded
WinUI UITests Controls Shell2 ✅ succeeded
WinUI UITests Controls Window ✅ succeeded
🧪 Device tests — Controls.Lifecycle, Controls.Modal, Controls.NavigationPage, Controls.PageTransitions +3 on Android, iOS, MacCatalyst, Windows

✅ maui-pr-devicetests #1698123 passed.

GPT-6.2 Sol: Run the new PageTransitions device tests and focused navigation, modal, Shell, window, and lifecycle coverage on all four platforms.
MAI Code 2: Run transition-specific, navigation, modal, Shell, Window, and lifecycle device coverage on all platforms.

🧪 Ran — 7 categories on Android, iOS, MacCatalyst, Windows

Platform Categories
Android Controls.Lifecycle, Controls.Modal, Controls.NavigationPage, Controls.PageTransitions, Controls.Shell, Controls.Window, Core.NavigationPage
iOS Controls.Lifecycle, Controls.Modal, Controls.NavigationPage, Controls.PageTransitions, Controls.Shell, Controls.Window, Core.NavigationPage
MacCatalyst Controls.Lifecycle, Controls.Modal, Controls.NavigationPage, Controls.PageTransitions, Controls.Shell, Controls.Window, Core.NavigationPage
Windows Controls.Lifecycle, Controls.Modal, Controls.NavigationPage, Controls.PageTransitions, Controls.Shell, Controls.Window, Core.NavigationPage
📊 Results — succeeded: 6 passed, 0 failed of 6 jobs

🔗 All test results · Build logs

Job Result
net11.0 CoreCLR Android Helix Tests Run DeviceTests Android (CoreCLR) ✅ succeeded
net11.0 CoreCLR iOS Helix Tests Run DeviceTests iOS (CoreCLR) ✅ succeeded
net11.0 CoreCLR ios/catalyst/android Helix Tests Build Device Tests (CoreCLR) ✅ succeeded
net11.0 CoreCLR MacCatalyst Helix Tests Run DeviceTests MacCatalyst (CoreCLR) ✅ succeeded
net11.0 Windows Helix Tests - Build Build Device Tests (Windows) ✅ succeeded
net11.0 Windows Helix Tests Run DeviceTests Windows ✅ succeeded
⏭️ Skipped — what neither suite runs

UI tests — 72 categories, 0 platforms

Categories not run: Accessibility, ActionSheet, ActivityIndicator, Animation, AppLinks, Border, BoxView, Brush, Button, CarouselView, CollectionView1, CollectionView2, CollectionView3, CollectionView4, CollectionView5, CollectionView6, CollectionView7, Cells, CheckBox, ContextActions, CustomRenderers, DatePicker, Dispatcher, DisplayAlert, DisplayPrompt, DragAndDrop, Entry, Editor, Effects, Essentials, FlyoutPage, Focus, Fonts, Frame, Gestures, GraphicsView, Image, ImageButton, IndicatorView, InputTransparent, IsEnabled, IsVisible, Label, Layout, ManualReview, Maps, Page, Performance, Picker, ProgressBar, RadioButton, RefreshView, SafeAreaEdges, Shadow, ScrollView, SearchBar, Shape, Slider, SoftInput, Stepper, Switch, SwipeView, TabbedPage, TableView, TimePicker, TitleView, ToolbarItem, Triggers, ViewBaseTests, VisualStateManager, WebView, Material3

Each skipped platform and category is listed as a Skipped maui-pr-uitests (skipped) … check on this commit. Use /azp run maui-pr-uitests for the full suite.

Device tests — 97 categories, 0 platforms

Categories not run: Controls.Accessibility, Controls.Application, Controls.Behavior, Controls.Border, Controls.BoxView, Controls.Button, Controls.CarouselView, Controls.CheckBox, Controls.CollectionView, Controls.Compatibility, Controls.ContentView, Controls.DatePicker, Controls.Dispatcher, Controls.Editor, Controls.Element, Controls.Entry, Controls.FlexLayout, Controls.FlyoutPage, Controls.Frame, Controls.Gesture, Controls.HybridWebView, Controls.Image, Controls.Label, Controls.Layout, Controls.Map, Controls.Mapper, Controls.Memory, Controls.MenuFlyout, Controls.Page, Controls.Path, Controls.Picker, Controls.RadioButton, Controls.RefreshView, Controls.ScrollView, Controls.SearchBar, Controls.Shape, Controls.Slider, Controls.SwipeView, Controls.Switch, Controls.TabbedPage, Controls.TemplatedView, Controls.TextInput, Controls.Toolbar, Controls.View, Controls.VisualElement, Controls.VisualElementTree, Controls.WebView, Controls.WindowOverlay, Controls.Xaml, Core.ActivityIndicator, Core.Animation, Core.Application, Core.Border, Core.BoxView, Core.Button, Core.CheckBox, Core.ContentView, Core.DatePicker, Core.Dispatcher, Core.Editor, Core.Element, Core.Entry, Core.FlowDirection, Core.FlyoutView, Core.Fonts, Core.Formatting, Core.Graphics, Core.GraphicsView, Core.Image, Core.ImageButton, Core.ImageSource, Core.IndicatorView, Core.Label, Core.Layout, Core.Lifecycle, Core.MauiContext, Core.Memory, Core.Page, Core.Picker, Core.ProgressBar, Core.RadioButton, Core.RefreshView, Core.ScrollView, Core.SearchBar, Core.ShapeView, Core.Slider, Core.Stepper, Core.SwipeView, Core.Switch, Core.TimePicker, Core.View, Core.WebView, Core.Window, Core.WindowOverlay, Graphics, Essentials, BlazorWebView

Each skipped platform and project is listed as a Skipped maui-pr-devicetests (skipped) … check on this commit. Use /azp run maui-pr-devicetests for the full suite.

🤖 Why these tests — AI rationale (GPT-6.2 Sol + MAI Code 2)

UI tests

Each model chose independently; every test that runs was selected by at least one of them.

Platform GPT-6.2 Sol MAI Code 2
Android Navigation, Shell1, Shell2, Lifecycle Navigation, Shell1, Shell2
iOS Navigation, Shell1, Shell2, Window, Lifecycle Navigation, Shell1, Shell2, Window
MacCatalyst Navigation, Shell1, Shell2, Window, Lifecycle Navigation, Shell1, Shell2, Window
Windows Navigation, Shell1, Shell2, Window, Lifecycle Navigation, Shell1, Shell2, Window

GPT-6.2 Sol — Run targeted UI coverage for page transitions, Shell routing, modal navigation, and window root replacement on all four platforms.

  • Issue6 and stack/modal managers: Navigation on all four platforms.
  • Shell routing and tab transitions: both Shell shards.
  • Root swaps and modal events: Window where runnable and Lifecycle.
  • Startup only installs the navigation hook; no wider run.

MAI Code 2 — Cross-platform page-transition feature; run Navigation, Shell, and Window UI coverage on all four platforms.

  • The new Issue6 shared-element/page-transition test is categorized Navigation and runnable on every platform.
  • NavigationPage, modal, stack, and platform transition managers changed across Android, iOS/Mac Catalyst, and Windows, so Navigation is required on all platforms.
  • Shell stack navigation and iOS/Mac Catalyst tab switching changed, with cross-platform Shell APIs and transition resolution, so the Shell umbrella is required.
  • Window.ReplacePageAsync and root-page transitions are newly implemented, so Window coverage is coupled to the feature; unrelated control categories and a full run are unnecessary.

Device tests

Each model chose independently; every test that runs was selected by at least one of them.

Platform GPT-6.2 Sol MAI Code 2
Android Controls.PageTransitions, Controls.NavigationPage, Core.NavigationPage, Controls.Modal, Controls.Shell, Controls.Window, Controls.Lifecycle Controls.PageTransitions, Core.NavigationPage, Controls.NavigationPage, Controls.Modal, Controls.Shell, Controls.Window, Controls.Lifecycle
iOS Controls.PageTransitions, Controls.NavigationPage, Core.NavigationPage, Controls.Modal, Controls.Shell, Controls.Window, Controls.Lifecycle Controls.PageTransitions, Core.NavigationPage, Controls.NavigationPage, Controls.Modal, Controls.Shell, Controls.Window, Controls.Lifecycle
MacCatalyst Controls.PageTransitions, Controls.NavigationPage, Core.NavigationPage, Controls.Modal, Controls.Shell, Controls.Window, Controls.Lifecycle Controls.PageTransitions, Core.NavigationPage, Controls.NavigationPage, Controls.Modal, Controls.Shell, Controls.Window, Controls.Lifecycle
Windows Controls.PageTransitions, Controls.NavigationPage, Core.NavigationPage, Controls.Modal, Controls.Shell, Controls.Window, Controls.Lifecycle Controls.PageTransitions, Core.NavigationPage, Controls.NavigationPage, Controls.Modal, Controls.Shell, Controls.Window, Controls.Lifecycle

GPT-6.2 Sol — Run the new PageTransitions device tests and focused navigation, modal, Shell, window, and lifecycle coverage on all four platforms.

  • PageTransitionsTests adds native transition and provider coverage.
  • Stack managers and NavigationViewHandler affect both NavigationPage units.
  • Modal and Shell handlers affect their own units.
  • Root replacement and modal events affect Window and Lifecycle, not base handlers.

MAI Code 2 — Run transition-specific, navigation, modal, Shell, Window, and lifecycle device coverage on all platforms.

  • The changed PageTransitions device tests are in Controls.PageTransitions and directly exercise presets, shared elements, modal transitions, Shell navigation, and root replacement; always include this unit.
  • Core and Controls NavigationPage handlers/managers changed, requiring Core.NavigationPage and Controls.NavigationPage on every affected platform.
  • Modal navigation managers changed and the new tests cover present/dismiss transitions, requiring Controls.Modal.
  • Shell handlers, renderer paths, navigation parameters, and GoToAsync transition behavior changed, requiring Controls.Shell.
  • Root-page replacement observes Window page and destruction state, requiring Controls.Window and Controls.Lifecycle; no Graphics/Essentials or full-suite run is needed.

Generated by /review run-tests. A targeted run is a fast signal, not full-suite certification.

…a Border

A Label's WinUI TextBlock is only as tall as its text, so Appium reported its height rather than the
240 the element was laid out at. A Border has its own automation peer on WinUI and reports its laid-out
size on every platform.
Copilot AI balanced review requested due to automatic review settings November 25, 2026 00:32
@kubaflo

This comment has been minimized.

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.

Comment on lines +629 to +630
// Within a frame of the end is the end.
return remaining > 16 ? remaining : 0;
assigned.TrySetResult(true);
}
};
window.PropertyChanged += handler;
}
}

var children = element.GetVisualChildren();
Comment on lines +583 to 585
nextRequest.Transition = null;

await PushModalPlatformAsync(nextPage, animated);
Comment on lines +680 to +683
if (isPresented && !applyNow
&& (Animations.PageTransitionResolver.TakePendingTransition(modal, Animations.NavigationTransitionKind.PopModal)
?? Animations.PageTransitionResolver.GetShellOverride(modal)) is { } deferredTransition)
_pendingPopTransitions[modal] = deferredTransition;

@github-actions github-actions Bot 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.

Expert Review — 15 findings

Reviewed commit 39fdd34.

See inline comments for details.

assigned.TrySetResult(true);
}
};
window.PropertyChanged += handler;

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.

[major] Memory Leak Prevention - Start ReplacePageAsync(B), then ReplacePageAsync(C) from Window.PropertyChanged for B. The Android and iOS/MacCatalyst helpers can reach WhenAssignedAsync(B) after C has superseded B. B's cleanup task wins Task.WhenAny, but this separate subscription is removed only if B becomes the root again; Untrack removes a different observer. The live window therefore retains B, its page tree and BindingContext indefinitely. Dispose/cancel this waiter when cleanup or supersession wins. The overlapping-root tests check completion and native state, not collection of B.

bool animated = nextRequest.IsAnimated;

// A deferred presentation runs with the transition it was requested with.
Animations.PageTransitionResolver.Restage(nextPage, Animations.NavigationTransitionKind.PushModal, nextRequest.Transition);

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.

[major] Logic and Correctness Verification - A deferred modal presentation clears its saved transition before presentation succeeds. Queue a per-call Fade while the backend is not ready, then let the first presentation consume the restaged override and throw. PushModalWithOverrideAsync restores the platform stack and leaves the logical request for retry, but its Transition is now null. RequestSync retries with the attached/default transition instead of Fade. Keep the saved snapshot until successful presentation. DeferredPresentationReplaysItsSavedTransition covers only successful replay; add consume-then-fail/retry coverage.


// A dismissal the platform runs later keeps its per-navigation transition until then, whether it was passed to
// PopModalAsync or comes from the GoToAsync that routed back (which ends before the dismissal runs).
if (isPresented && !applyNow

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.

[major] Logic and Correctness Verification - An inline modal dismissal never saves its per-call override because this capture requires !applyNow. Present with Slide, request PopModalAsync(Scale) on a ready backend, and let the backend consume Scale before throwing. PopModalWithOverrideAsync restores the presented modal for reconciliation, but RequestSync retries with the recorded Slide because Scale was consumed and never saved. Preserve retry intent for immediate attempts too, clearing it only after successful dismissal. The failed-pop retry tests assert the animated boolean, not the transition.


// The root page can't be popped, so nothing is staged for it.
var stack = navigation.NavigationStack;
var top = stack.Count > 1 ? stack[stack.Count - 1] : null;

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.

[major] Navigation & Shell - The top captured here need not be the page Shell eventually pops. With root/A, defer a push of B in Shell.Navigating, then call Navigation.PopAsync(Scale) and defer that request too. Complete B's push first, then resume the pop. ShellNavigationManager recomputes the relative pop and removes B, but Scale was staged on A; B reverses its recorded transition instead. Carry the override with the pop request and attach it after the outgoing page is selected, as the modal-pop overload does. The current concurrency tests do not cover this deferral ordering.


list.Add(visual);
}
}

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.

[major] Logic and Correctness Verification - GetVisualChildren exposes logical children, including every TabbedPage tab; inactive tabs normally remain IsVisible=true. Push a detail from a TabbedPage whose active and inactive tabs each contain a hero named photo, with one matching detail hero and no Group. Walk collects both source heroes and Pick rejects them as ambiguous, so the visible active-tab hero never flies on Android/iOS/MacCatalyst. Traverse only the displayed page of page containers before deciding uniqueness. Pairing tests cover explicitly hidden layouts, not inactive tabs.


// The views' own transform and alpha (a custom page handler can set them): poses are applied on top of them,
// and they are what the views go back to, whether the transition finishes or is cancelled.
var toOriginal = toView is null ? default : (toView.Transform, toView.Alpha);

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.

[moderate] Native Platform Defaults Preservation - UIView.Transform captures only an affine transform, not the full Layer.Transform. A custom page handler with a native CATransform3D Y rotation and perspective loses those components when ApplyPose writes UIView.Transform; Finish restores only the affine capture. RootPageTransition.iOS uses the same capture/application pattern. With unchanged managed properties, ReapplyChanged does nothing, leaving the native 3D configuration lost after completion or cancellation. Preserve and compose the full native transform; identity-transform tests do not cover this configuration.

public bool HasPivot { get; }

public static NativePose Of(AView view)
=> new(view.TranslationX, view.TranslationY, view.ScaleX, view.ScaleY, view.Alpha, view.PivotX, view.PivotY, !OperatingSystem.IsAndroidVersionAtLeast(28) || view.IsPivotSet);

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.

[moderate] Native Platform Defaults Preservation - On Android API 23-27 this always records HasPivot=true, even when android:id/content uses its native automatic center pivot. Pose sets an explicit pivot and Restore writes the captured coordinates, permanently replacing automatic centering. After an animated ReplacePageAsync followed by a window resize or rotation, a native scale/rotation uses the old center instead of the new one. Preserve automatic-pivot behavior on these supported versions; the API 28+ ResetPivot branch alone does not cover them. The root tests do not resize afterwards.

{
view.PivotX = width / 2f;
view.PivotY = height / 2f;
view.TranslationX = original.TranslationX + (float)(pose.TranslationX * width);

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.

[moderate] Android Platform Specifics - Pose replaces the content view's existing pivot with the center while retaining its scale and translation. If the Activity configured android.R.id.content with ScaleX=0.8 and PivotX=0, even a Fade root replacement shifts the live content horizontally by 0.1 times its width: the fade adds no scale or translation, but changing the pivot changes the existing scale's origin. Cleanup restores the original pivot and the root jumps back. Preserve the original pivot or compensate translation when composing the transition.

{
if (canFly)
{
heroes = SharedTransition.FindPairs(request.From, request.To);

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.

[moderate] Performance-Critical Path Optimization - Ordinary animated push/pop with no transition properties or shared-element names now synchronously walks the outgoing page's entire visible tree before keeping the platform animation. FindPairs calls Collect/Walk even when neither page uses shared elements, adding descendant-count-dependent UI-thread work and child-collection allocations to navigation from a large ScrollView/BindableLayout. This also happens in Windows' Platform branch despite presetsCarryHeroes=false. Track shared-element registration with suitable invalidation so pages with none can bypass discovery; current default-transition tests verify selection, not traversal.


// A deferred dismissal runs with the transition it was requested with.
if (_pendingPopTransitions.TryGetValue(platformModal, out var popTransition))
Animations.PageTransitionResolver.Restage(platformModal, Animations.NavigationTransitionKind.PopModal, popTransition);

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.

[moderate] Memory Leak Prevention - Each deferred-dismissal attempt inserts a pending entry, but a throwing PopModalPlatformAsync skips DropPending. With an external backend that does not consume the built-in resolver, a failed attempt followed by a successful RequestSync leaves the first entry behind: the success removes only its own newer entry. Repeated failures accumulate obsolete transitions and objects captured by custom Easing delegates for the lifetime of a cached modal. Release each attempt's exact staging token in finally, keeping retry intent separately. The deferred-dismissal test consumes the entry and covers success only.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings November 25, 2026 19:53
@kubaflo

kubaflo commented Nov 25, 2026

Copy link
Copy Markdown
Contributor

Resolved the conflicts with main in 6e45fc9943. The six Controls API inventories now include the page-transition and shared-element APIs alongside the ContentButton, Span decoration, and CollectionView scroll-anchor APIs from main. The transition implementation and tests are unchanged by the conflict resolution.

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.

uiWindow.BringSubviewToFront(picture);
if (incoming is not null)
{
incomingOriginal = (incoming.Transform, incoming.Alpha);
}

bool isPlatformReady = IsModalReady;
if (!(isPlatformReady && !syncing))
Comment on lines +141 to +142
_interaction = new UIPercentDrivenInteractiveTransition();
_driving = driving;
@aritchie

aritchie commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor Author

The review bot you guys are using is insane. My agent went back and forth with copilot all day yesterday. The feature is already done and working elsewhere. It shouldn't be such a big deal here - tests are passing.

FYI @Redth

@kubaflo
kubaflo merged commit f7d3fc1 into dotnet:main Nov 25, 2026
8 of 16 checks passed
KarthikRajaKalaimani pushed a commit to KarthikRajaKalaimani/maui that referenced this pull request Nov 26, 2026
…k and shared elements (dotnet#40537)

### Target Branch

| This PR is for | Initial base |
| --- | --- |
| New features, API changes, or .NET 12 work (including .NET 12 fixes) |
`main` |

- [x] I selected the applicable base branch using the [contribution
guide](https://github.com/dotnet/maui/blob/main/.github/CONTRIBUTING.md#choose-your-pr-base-before-starting).

### Description of Change

This implements **phase 4a** (built-in page transitions and the
navigation hook they're built on) and the **shared elements of phase
4b** from dotnet#40382, using the spec's names. It doesn't depend on the
storyboard PR; `StoryboardTransition` follows once that lands. It is
based on [Shiny page
transitions](https://shinylib.net/controls/page-transitions/), rebuilt
on MAUI's navigation managers instead of replacement renderers and
wrapped delegates.

#### API (`Microsoft.Maui.Controls.Animations`)
- **Transition types:** `PageTransition` is a closed hierarchy.
  - `Platform` and `None` are shared values that can't be changed.
- Each transition has `Duration` (300 ms by default), `Easing` and
`Background`.
- The subclasses are `FadeTransition`, `SlideTransition` (`From` takes a
`SlideEdge`: Start, End, Top or Bottom, with Start and End following
`FlowDirection`) and `ScaleTransition` (`FromScale`).
- A type converter accepts `Platform`, `None`, `Fade`, `SlideFromEnd`,
`SlideFromStart`, `SlideFromTop`, `SlideFromBottom` and `Scale`.
- **`PageTransitions`:** the attached properties `Transition`,
`ModalTransition` and `TabTransition`, and extension overloads for
`PushAsync`, `PopAsync`, `PushModalAsync`, `PopModalAsync`, `GoToAsync`
and `Window.ReplacePageAsync`. `INavigation` and `Shell` gain no
members, and existing calls bind exactly as before.
- **`SharedTransition`:** attached `Name` and `Group`.
- **Navigation hook:** `INavigationTransitionProvider` replaces renderer
subclassing.
- Providers are registered through DI and consulted in order. Each one
can handle a navigation, decline it, or suppress its animation.
- Each provider receives a `NavigationTransitionRequest` (kind, both
pages, the resolved transition, back or forward, interactive or not,
flow direction) and returns a `PlatformNavigationTransition`, which
wraps an iOS animator and interaction controller, an Android
`Animation`, or a Windows `NavigationTransitionInfo`.
  - MAUI's own presets are the last provider.
- The existing virtual overrides (Android `OnCreateNavigationAnimation`,
Windows `GetNavigationTransition`) still take precedence.

#### Which transition runs
1. An explicit "don't animate" (`animated: false`) means `None`.
2. Then a per-navigation argument.
3. Then the attached property on the page being shown.
4. Then the nearest ancestor that sets it: `NavigationPage`, `Shell` or
`Window`.
5. Otherwise `Platform`.

Going back reverses the transition that actually ran, which is recorded
on the navigation entry, unless the `PopAsync` passes one of its own.
Reduced motion turns every transition except `Platform` into `None`, and
`Platform` leaves reduced motion to the OS.

#### Platforms
- **iOS and Mac Catalyst:**
- `UIViewControllerAnimatedTransitioning` for `NavigationPage` and for
both Shell paths (the renderer and the handler).
- The edge swipe-back keeps following the finger with presets and with a
provider's interaction controller.
- Modals go through the transitioning delegate, presented over the page
underneath unless the page sets its own presentation style.
  - Shell tab switches (renderer) and `ReplacePageAsync` animate.
  - Shared elements fly as snapshots inside the transition context.
- **Android:**
- Fragment animations for `NavigationPage` and the default Shell
handler.
  - Modal transitions replace the hard-wired slide-up.
  - `ReplacePageAsync` animates through the window overlay.
  - Shared elements fly in the decor overlay.
- **Windows:**
- Presets map to the nearest `NavigationTransitionInfo` (Slide, DrillIn,
Entrance, Suppress), so `Duration` and `Easing` aren't honored there
yet.

#### Known gaps (open for discussion)
- **Not wired:** the Android compat `ShellRenderer`, and the legacy iOS
`NavigationRenderer`.
- **Shell tabs:** not wired on Android, on iOS's opt-in `ShellHandler`,
on `TabbedPage` or on Windows.
- **Gestures:** interactive Android predictive back (open question Q5).
- **Windows:** the two-presenter Composition host, which `Duration`,
`Easing`, Fade and Scale need. Modals, tabs and root replacement aren't
wired either.
- **Modals:** shared elements don't fly during modal navigation.

### Tests
- **`Controls.Core.UnitTests/Animations`:** 89 tests, covering the
resolution order, back reversing what ran (including one-off overrides),
the provider chain (handle, decline, suppress, order, virtuals winning),
the converter strings, RTL slide edges, overload binding, shared-element
pairing and `Group` disambiguation with the missing-match fallback,
reduced motion, and completion after the transition.
- **`Xaml.UnitTests` (`PageTransitionsXaml`):** 10 tests under Runtime,
XamlC and SourceGen.
- **`Controls.DeviceTests` (`PageTransitions`):** 9 tests, all passing
on an Android API 37 emulator. iOS, Mac Catalyst and Windows weren't run
locally.
- **UI test:** `Issue6`, a HostApp page and an NUnit test. It builds; it
hasn't been run locally (no Appium).
- **The tests fail without the code:** each of these changes to the
resolver, re-run against the suite, fails tests:
  - ignoring the per-call argument (6),
  - ignoring the recorded pop (4),
  - skipping the providers (6),
  - dropping reduced motion (2),
  - skipping the ancestor walk (2).

### Notes
This PR shares two hunks with the storyboard PR: the animations
`XmlnsDefinition` and the XamlC `EasingTypeConverter` fix. Whichever
merges second drops them.

### Issues Fixed

Contributes to #6 and dotnet#40382 (phases 4a and 4b, shared elements).

---------

Co-authored-by: Jakub Florkowski <kubaflo123@gmail.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
kubaflo added a commit that referenced this pull request Nov 28, 2026
…0755)

<!-- Please let the below note in for people that find this PR -->
> [!NOTE]
> Are you waiting for the changes in this PR to be merged?
> It would be very helpful if you could [test the resulting
artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from
this PR and let us know in a comment if this change resolves your issue.
Thank you!

<!--
Open .NET 11 fix PRs against net11 for review; target main for
next-major features.
After approval, a maintainer manually retargets the fix PR to the active
inflight
branch and merges it directly there. Do not merge individual fixes into
net11.
Bots must not retarget or merge. Candidate integration into net11 and
release/*
changes are separate, explicitly coordinated release work.
-->

### Target Branch

| This PR is for | Initial base |
| --- | --- |
| New features, API changes, or .NET 12 work (including .NET 12 fixes) |
`main` |
| .NET 11 servicing fixes | `net11`, for review |
| Older servicing, release integration, infrastructure, or documentation
| The branch designated for that work |

- [x] I selected the applicable base branch using the [contribution
guide](https://github.com/dotnet/maui/blob/main/.github/CONTRIBUTING.md#choose-your-pr-base-before-starting).

For .NET 11 fixes, only a maintainer retargets the approved PR to the
active
inflight lane and merges it after CI validates that final base. Do not
merge
individual fixes directly into `net11`; agents must not retarget or
merge.

### Description of Change

Fix the deterministic `PageTransitionsTests` failures on `main`,
including the product defects exposed once the More controller actually
runs the transition.

#### Product fixes

- **Programmatically selected overflow tabs never installed the More
navigation delegate.** UIKit reports the selected section's own
controller, not `MoreNavigationController`, even though it displays that
section inside More. Both Shell implementations now install their
existing delegate for overflow sections when there are more than five
tabs. This enables the custom animator, completion tracking, and
shared-element flights.
- **The compatibility renderer popped the wrong native stack.** Its
pop-to-root operation now targets the overflow section's root on the
active More controller and completes through the same transition-aware
path as a single pop. It also reads the active controller's top page
when recording an unanimated push, so a later pop reverses `None`
instead of the page's configured Fade.
- **The managed transition-coordinator binding rejects a null animation
callback.** Supply a no-op animation callback while registering
completion. Once the missing More delegate was fixed, the original
callback produced `ArgumentNullException: animate` from
`UIViewControllerTransitionCoordinatorWrapper.AnimateAlongsideTransition`.

Native/default More navigation still completes immediately; only custom
page transitions wait for their animation.

#### Corrections to provably invalid test setup

- `WindowHandlerStub` presents a workspace inside the runner's window;
it never replaces `UIWindow.RootViewController`. Root-replacement tests
now use a separate real window with the production content mapper. Their
snapshot probe checks UIKit's native replicant class instead of the CLR
`UIView` wrapper name.
- `Window.PropertyChanged` runs **before** native content mapping.
Install the root's own animation after the assignment, assert that it
exists, and finish the replacement without detaching the root. Detaching
an outgoing root lets UIKit remove its animations independently of
MAUI's cleanup, invalidating the original assertion.
- The destination may not have a handler immediately after `PushAsync`
starts. Wait for its content to load before reading native visibility,
and use a short asynchronous delay when polling so the platform
animation loop can run. The original Android test throws in
`NativeShown` before it can inspect a flight.
- More navigation intentionally completes immediately for an unanimated
push. Wait for the pushed content to load before issuing the next
push/pop-to-root; otherwise UIKit has not yet finished presenting that
controller.

#### Which landing introduced this?

The faulty transition code and tests came from #40537 (`f7d3fc1c99`),
not the storyboard landing #40536 (`c1f549fd52`). Comparing those
commits for all six files changed here produces an **empty diff**. The
tests do not use storyboard animation holds. #40537's recorded checks
include `maui-pr` but no `maui-pr-devicetests` check, so its successful
build was not evidence that these device tests passed.

The supplied main-branch CI window was last green at
[1699752](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1699752)
(`eeda7f80ed`), with the failures present from
[1699985](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1699985)
(`c1f549fd52`) onward, including
[1703407](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1703407).

Before implementation, searched open and recently merged PRs across all
bases, including `release/*`, `inflight/*`, and `candidate/*`. Inspected
#40658 (bottom-sheet/modal transitions), #40344 (tab reselection),
#40656 (TabbedPage lifecycle), #40696 (queued animation cancellation),
and #40710 (zero-length tweens); none contains these fixes.

#### Local causal validation

All counts below are **passed / failed**, read from fresh XHarness XML
with exact-class isolation verified. Each platform was measured on
original sources, with the correction, with the correction reverted, and
with it restored. No physical devices were used.

| Phase | iOS 27 simulator | Mac Catalyst | Android API 33 emulator |
| --- | --- | --- | --- |
| Original baseline | 18 / 6 | 18 / 6 | 12 / 1 |
| Fixed | 24 / 0 | 24 / 0 | 13 / 0 |
| Reverted | 18 / 6 | 18 / 6 | 12 / 1 |
| Restored | 24 / 0 | 24 / 0 | 13 / 0 |

The reverted Apple failures are the two root tests and both variants of
the More navigation/shared-element tests. Android reproduces the
destination-handler `NullReferenceException`. The Helix Mac Catalyst
opacity timeout did **not** reproduce locally; that case passed locally
before and after the correction. Final validation additionally passed
**24 / 0 on an iOS 18.5 simulator**.

Commands below were run from an isolated worktree based on `main` at
`6d74c1c0d9`. `.dotnet` contains the SDK pinned by `global.json`
(`12.0.100-alpha.1.26523.103`); Xcode is 27.2.

```bash
export PATH="$PWD/.dotnet:$PATH"
export DOTNET_ROOT="$PWD/.dotnet"
export TMPDIR="$PWD/artifacts/transition-evidence/scratch"
export DOTNET_CLI_USE_MSBUILD_SERVER=0
export MSBUILDDISABLENODEREUSE=1
export DOTNET_ROLL_FORWARD=Major
export HEADLESS=true
```

Preparation — all succeeded:

```bash
dotnet build src/DotNet/DotNet.csproj -p:InstallDotNet=false -p:TreatWarningsAsErrors=false -v:minimal
dotnet workload install ios maccatalyst --skip-manifest-update --verbosity minimal
dotnet build Microsoft.Maui.BuildTasks.slnf -p:TreatWarningsAsErrors=false --disable-build-servers -v:minimal
dotnet tool restore
```

iOS causal runs — original/reverted failed **18/6**; fixed/restored
passed **24/0**:

```bash
pwsh .github/skills/run-device-tests/scripts/Run-DeviceTests.ps1 -Project Controls -Platform ios -iOSVersion 27 -TestFilter 'Category=PageTransitions' -IncludeClasses Microsoft.Maui.DeviceTests.PageTransitionsTests -SkipXcodeVersionCheck -Timeout 00:10:00 -Rebuild
```

Mac Catalyst causal runs — original/reverted failed **18/6**;
fixed/restored passed **24/0**:

```bash
pwsh .github/skills/run-device-tests/scripts/Run-DeviceTests.ps1 -Project Controls -Platform maccatalyst -TestFilter 'Category=PageTransitions' -IncludeClasses Microsoft.Maui.DeviceTests.PageTransitionsTests -SkipXcodeVersionCheck -Timeout 00:10:00 -Rebuild
```

Android causal runs — original/reverted failed **12/1**; fixed/restored
passed **13/0**:

```bash
export EmbedAssembliesIntoApk=true
pwsh .github/skills/run-device-tests/scripts/Run-DeviceTests.ps1 -Project Controls -Platform android -TestFilter 'Category=PageTransitions' -IncludeClasses Microsoft.Maui.DeviceTests.PageTransitionsTests -Timeout 00:10:00 -Rebuild
```

The runner selected `emulator-5556` and passed `--instrumentation
com.microsoft.maui.controls.devicetests.TestInstrumentation`. A separate
read-only API 33 emulator was used after another emulator's unauthorized
ADB transport prevented the initial attempt from running tests.

iOS 18.5 final compatibility check — passed **24/0**:

```bash
pwsh .github/skills/run-device-tests/scripts/Run-DeviceTests.ps1 -Project Controls -Platform ios -iOSVersion 18.5 -TestFilter 'Category=PageTransitions' -IncludeClasses Microsoft.Maui.DeviceTests.PageTransitionsTests -SkipXcodeVersionCheck -Timeout 00:10:00
```

Formatting/checks — passed, with workspace-loading warnings from the
formatter:

```bash
dotnet format whitespace Microsoft.Maui.sln --no-restore --include src/Controls/tests/DeviceTests/Elements/PageTransitions/PageTransitionsTests.cs src/Controls/tests/DeviceTests/Elements/PageTransitions/PageTransitionsTests.iOS.cs --verify-no-changes
git diff --check
```

The full repository formatter was also attempted; it emitted unrelated
analyzer edits and multi-target conflict markers. Those edits were
discarded, and the surgical patch was rebuilt and retested. No unrun CI
check is represented as passing.

### Issues Fixed

<!-- Please make sure that there is a bug logged for the issue being
fixed. The bug should describe the problem and how to reproduce it. -->

Deterministic main-branch `maui-pr-devicetests` failures described
above; tracked here by the linked failing builds rather than an
unrelated issue number.

### Let AI finish this PR

- [ ] **Let the MAUI agent address review feedback and fix remaining
issues on this PR.** Maintainers still decide whether it is merged. For
PRs from forks, the agent opens a follow-up PR that keeps your commits.

<!--
Verify the target branch follows the release workflow in
docs/ReleaseBranchWorkflow.md.
Infrastructure and documentation changes should target the branch where
they apply.
-->

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
kubaflo added a commit that referenced this pull request Nov 28, 2026
…e detail hero accessible (#40768)

<!-- Please let the below note in for people that find this PR -->
> [!NOTE]
> Are you waiting for the changes in this PR to be merged?
> It would be very helpful if you could [test the resulting
artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from
this PR and let us know in a comment if this change resolves your issue.
Thank you!

<!--
Open .NET 11 fix PRs against net11 for review; target main for
next-major features.
After approval, a maintainer manually retargets the fix PR to the active
inflight
branch and merges it directly there. Do not merge individual fixes into
net11.
Bots must not retarget or merge. Candidate integration into net11 and
release/*
changes are separate, explicitly coordinated release work.
-->

### Target Branch

| This PR is for | Initial base |
| --- | --- |
| New features, API changes, or .NET 12 work (including .NET 12 fixes) |
`main` |
| .NET 11 servicing fixes | `net11`, for review |
| Older servicing, release integration, infrastructure, or documentation
| The branch designated for that work |

- [x] I selected the applicable base branch using the [contribution
guide](https://github.com/dotnet/maui/blob/main/.github/CONTRIBUTING.md#choose-your-pr-base-before-starting).

For .NET 11 fixes, only a maintainer retargets the approved PR to the
active
inflight lane and merges it after CI validates that final base. Do not
merge
individual fixes directly into `net11`; agents must not retarget or
merge.

### Description of Change

Test-only corrections for the Windows page-transition failures
introduced with #40537. No product behavior or platform coverage is
removed.

**Device tests:** the recording-provider assertions assumed that the
host enables animations. Windows reads `UISettings.AnimationsEnabled`;
under reduced motion, `PageTransitionResolver` deliberately converts
presets to `None` and bypasses every provider. An empty recording
collection is therefore expected in that mode, not evidence that Windows
lacks a navigation hook. The Windows `StackNavigationManager` already
invokes the hook for both animated and unanimated requests, and the test
application installs it through `UseMauiApp`.

The fixture now explicitly selects the animation-enabled resolver branch
and restores the previous override after asynchronous teardown, even
when teardown fails. A focused device test also explicitly selects
reduced motion and checks that push/pop still navigate without
consulting providers. This preserves the accessibility contract instead
of changing the product to satisfy animation tests.

**UI test:** `SharedElementLandsAndSourceIsRestoredAfterPop` times out
locating `DetailTile`, not navigating or restoring a flight. The
captured Windows page source already contains `DetailStatus = "Arrived
at 2"` and the hero's child text `"Detail"`, but no `DetailTile`.
`MauiBorderAutomationPeer` intentionally excludes unnamed structural
borders from the control view; `AutomationId` alone does not opt in.
Give the meaningful detail hero a semantic description so Appium can
find the border and measure its own bounds. The existing size,
restoration and repeat-navigation assertions remain unchanged.

WinUI presets intentionally do not host shared-element flights. The
existing device flight tests already exclude Windows for that documented
limitation; this PR adds no skips. The cross-platform UI test continues
to check final layout and navigation on Windows.

Upstream open and recently merged transition PRs were checked before
implementation. #40755 fixes Apple Shell navigation and Apple/Android
test fixtures, not these Windows assumptions.

#### Validation

| Evidence | Device tests | UI tests |
| --- | --- | --- |
| Baseline red | [main build
1703707](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1703707),
Windows packaged/unpackaged, logs 960/962 | [main build
1703706](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1703706),
Controls Navigation, log 5895 |
| Fix result | PR CI requested; pending | PR CI requested; pending |
| Revert/restore cycle | Not run: no Windows host is available | Not
run: no Windows host is available |

The five baseline device failures are
`PresetPushAndPopCompleteAfterTheTransition`,
`ShellGoToAsyncWithATransition`, `PerNavigationOverloadIsReversedOnPop`,
`ProviderCanSuppressTheAnimation`, and
`UnanimatedPushIsRecordedForThePop`. Raw CI logs and the UI page-source
attachment were inspected; no unavailable AzDO test-results API result
is inferred.

Local host: macOS, repository-pinned SDK `12.0.100-alpha.1.26523.103`.
**No local Windows runtime validation or successful full Windows build
is claimed.** Cross-targeting cannot run the native Windows PRI/XAML
tools on this host; Windows compilation and execution must be confirmed
by PR CI.

Commands and results:

```bash
dotnet build src/Controls/src/Core/Controls.Core.csproj -f net12.0-windows10.0.19041.0 -p:EnableWindowsTargeting=true
```

Failed initially: the host SDK was 11.0.100 (`NETSDK1045`). After
provisioning the pinned SDK, restore also visited uninstalled Apple
workloads. SDK setup succeeded:

```bash
dotnet build src/DotNet/DotNet.csproj -p:InstallWorkloadPacks=false -p:TreatWarningsAsErrors=false -v:q
```

The Windows-only restore attempt failed running `MakePri.exe` with an
exec-format error:

```bash
.dotnet/dotnet build src/Controls/src/Core/Controls.Core.csproj -f net12.0-windows10.0.19041.0 -p:EnableWindowsTargeting=true -p:TargetFrameworks=net12.0-windows10.0.19041.0 -v:q
```

Disabling native PRI generation for a compile attempt reached the native
WinUI XAML compiler, which produced no `output.json`. Both commands
failed with that host limitation:

```bash
.dotnet/dotnet build src/Controls/src/Core/Controls.Core.csproj -f net12.0-windows10.0.19041.0 -p:EnableWindowsTargeting=true -p:TargetFrameworks=net12.0-windows10.0.19041.0 -p:AppxGeneratePriEnabled=false -v:q
.dotnet/dotnet build src/Controls/tests/DeviceTests/Controls.DeviceTests.csproj -f net12.0-windows10.0.19041.0 -p:EnableWindowsTargeting=true -p:TargetFrameworks=net12.0-windows10.0.19041.0 -p:AppxGeneratePriEnabled=false -v:q
```

The required build tasks were built successfully before the final
device-build attempt:

```bash
.dotnet/dotnet build Microsoft.Maui.BuildTasks.slnf -p:IncludeIosTargetFrameworks=false -p:IncludeMacCatalystTargetFrameworks=false -p:IncludeAndroidTargetFrameworks=false -p:IncludeWindowsTargetFrameworks=false -v:q
```

Portable navigation-transition provider policy tests passed: **15
passed, 0 failed, 0 skipped**. These cover the resolver policy, not
Windows device execution:

```bash
.dotnet/dotnet test --project src/Controls/tests/Core.UnitTests/Controls.Core.UnitTests.csproj -p:IncludeIosTargetFrameworks=false -p:IncludeMacCatalystTargetFrameworks=false -p:IncludeAndroidTargetFrameworks=false -p:IncludeWindowsTargetFrameworks=false --filter-class '*NavigationTransitionProviderTests'
```

Formatting passed with workspace-loading warnings; whitespace validation
passed:

```bash
.dotnet/dotnet format Microsoft.Maui.sln --no-restore --include src/Controls/tests/DeviceTests/Elements/PageTransitions/PageTransitionsTests.cs src/Controls/tests/TestCases.HostApp/Issues/Issue6.cs --exclude Templates/src --exclude-diagnostics CA1822
git diff --check
```

### Issues Fixed

<!-- Please make sure that there is a bug logged for the issue being
fixed. The bug should describe the problem and how to reproduce it. -->

Addresses the deterministic main-branch CI failures linked above.
Related to #40537 and #40755.

### Let AI finish this PR

- [ ] **Let the MAUI agent address review feedback and fix remaining
issues on this PR.** Maintainers still decide whether it is merged. For
PRs from forks, the agent opens a follow-up PR that keeps your commits.

<!--
Verify the target branch follows the release workflow in
docs/ReleaseBranchWorkflow.md.
Infrastructure and documentation changes should target the branch where
they apply.
-->

---------

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
kubaflo added a commit that referenced this pull request Nov 29, 2026
…ng the initial navigation (#40795)

<!-- Please let the below note in for people that find this PR -->
> [!NOTE]
> Are you waiting for the changes in this PR to be merged?
> It would be very helpful if you could [test the resulting
artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from
this PR and let us know in a comment if this change resolves your issue.
Thank you!

<!-- copilot-assessment:v1 -->
### Agent assessment

Self-reported assessment, not an independent review.

Assessed revision: `d1f1c3803dfb83a81deaeedf0fcc19a3919871a0`

| Dimension | Assessment | Rationale |
|---|---|---|
| Change confidence | 8/10 | ↑ Red/green/revert/restore on macOS: the
added unit test fails on net11 without the guard (Expected 0, Actual 1),
passes with it, fails again when reverted, passes when restored.<br>↑
317 Controls.Core.UnitTests navigation tests pass with the guard.<br>↑
Same 8-line guard that is already on main, where the Windows
NavigationPage category passes.<br>↓ Windows device tests not run
locally (macOS host); CI is the validation. |
| Diagnosis confidence | 6/10 | ↑ The race is real and reproduced
deterministically by the unit test.<br>↑ The failing Windows test
(SettingTitleIconImageSourceDoesntCrash) pushes a NavigationPage right
after the handler connects, the exact scenario.<br>↓ The Windows host
crash has no managed stack or dump, so the link between this race and
the crash is inferred from main passing and net11 not, not observed
directly. |
| Evidence fit | 6/10 | ↑ The crash reproduces on every net11 run
(packaged and unpackaged, two heads) and not on main, where only this
guard differs in the navigation path.<br>↓ Not confirmed until
maui-pr-uitests runs on this PR; if NavigationPage still crashes the
diagnosis is wrong. |
<!-- /copilot-assessment -->

### Target Branch

- [x] I selected the applicable base branch (`net11`, .NET 11 fix, for
review).

### Description of Change

Backports the `NavigationPage.cs` hunk and its unit test from #40537
(already on `main`).

When the handler connects, `NavigationPage` starts an initial navigation
whose completion callback called `SendNavigated(null, ...)`, which reads
`CurrentPage`. If a page is pushed right after the handler connects,
`CurrentPage` is already the pushed page by the time the callback runs,
so its `NavigatedTo` is raised before its own navigation has run. The
callback now only sends the initial `Navigated` when `CurrentPage` is
still the page that navigation was for; the pushed page gets its
`NavigatedTo` from its own navigation.

This is the scenario of the Windows device test
`SettingTitleIconImageSourceDoesntCrash`, which pushes a
`NavigationPage` right after the window handler is created. That test
crashes the test host (exit 7, no managed stack) on every `net11` run of
maui-pr-uitests (build 1703903, packaged and unpackaged) and passes on
`main`, where this guard is present.

Validation (macOS, `Controls.Core.UnitTests`, net11.0):
- Baseline, test only:
`APushMadeBeforeTheInitialNavigationFinishesGetsNavigatedToOnlyFromItsOwnNavigation`
fails (Expected 0, Actual 1).
- With the guard: passes; `NavigationPageLifecycleTests` 10/10.
- Guard reverted: fails again (Actual 1).
- Guard restored: passes; navigation tests 317/317.

Not run locally: the Windows device test (Windows-only); maui-pr-uitests
on this PR is the validation.

### Issues Fixed

Fixes the NavigationPage host crash in maui-pr-uitests on `net11`.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community ✨ Community Contribution

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Spec] Transitions

3 participants