Skip to content

Support GoBackToRootAsync from modal contexts - #3447

Open
dansiegel wants to merge 6 commits into
masterfrom
ds/2812-modal-go-back-to-root
Open

dansiegel wants to merge 6 commits into
masterfrom
ds/2812-modal-go-back-to-root

Conversation

@dansiegel

@dansiegel dansiegel commented Oct 14, 2026 •

Copy link
Copy Markdown
Member

Description of Change

GoBackToRootAsync now dismisses every navigation modal in the calling page's window, including modal NavigationPages, and returns to the active page under Window.Page. The underlying navigation stack and existing nonmodal pop-to-root behavior are retained.

The calling page confirms the request once. A veto, canceled asynchronous confirmation, or stack change during confirmation leaves the operation's stacks untouched. Native modal pops are transactional: callbacks and destruction occur only after all pops succeed, and owned failed pops restore the original pages and scopes. An unrelated navigation change is preserved. If it prevents rollback after owned modal pops, already detached modal subtrees still receive departure callbacks and destruction; pages attached to any window are preserved and no destination arrival callback is sent. A cross-window transfer during a native pop rejects the root request without reclaiming transferred pages or their scopes, even if the originating stack otherwise matches the expected state.

The navigation snapshot covers inactive flyout/menu branches, exact tab child identity/order, and the active path. Device back/swipe requests are suppressed for all captured modals while the root request is pending. Removed pages, including inactive tabs and flyout menu children, receive back-navigation callbacks before destruction. Lifecycle errors are aggregated, and recursive cleanup continues through failing children, siblings, view models, and modal containers after native navigation commits. The retained destination receives the supplied parameters with Back mode.

Open dialogs must be closed through their dialog API before retrying a modal root request. The current dialog dismissal API is not awaitable, so a root request with an open dialog fails without mutation instead of bypassing its close veto, OnDialogClosed, result callback, and DialogStack lifecycle.

Validation on current head 4dfba4c:

  • Prism.DryIoc.Maui.Tests: net10.0 328/328; net11.0 325/325.
  • All 53 focused regression cases pass within both full suites.
  • Prism.Maui.Tests on prior head f5dd402: net10.0 354/354; net11.0 354/354 (hosted).
  • git diff --check passed.
  • Current-head hosted MAUI/CodeQL checks are pending; the existing native monitor is following them. Prior-head f5dd402 hosted MAUI validation passed: https://github.com/PrismLibrary/Prism/actions/runs/38586106964 .

Rebased cleanly onto master 11aad2b, which includes #3444. Its Avalonia/WPF source-sharing changes do not overlap this MAUI change.

Native UI verification remains necessary for platform transition animations, restored modal presentation after a native pop failure, and hardware-back handling while asynchronous confirmation is pending. Automated coverage uses the existing MAUI test infrastructure; it does not validate native rendering or transitions.

Bugs Fixed

API Changes

No public signature changes. Updated XML documentation for INavigationService.GoBackToRootAsync and PageNavigationService.GoBackToRootAsync.

Behavioral Changes

Calling GoBackToRootAsync from a modal NavigationPage now exits the entire navigation modal context instead of stopping at that NavigationPage's root. Intermediate modal pages are removed without arrival callbacks. The destination is the active child under Window.Page; its navigation history remains intact. Open dialogs require their normal close lifecycle before root navigation can proceed.

PR Checklist

  • Has tests (if omitted, state reason in description)
  • Rebased on top of master at time of PR
  • Changes adhere to coding standard

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-14T16:24:24.739493Z 4dfba4c New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 953cd8bc1b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/Maui/Prism.Maui/Navigation/PageNavigationService.cs Outdated
Comment thread src/Maui/Prism.Maui/Navigation/PageNavigationService.cs Outdated
Comment thread src/Maui/Prism.Maui/Navigation/PageNavigationService.cs Outdated
Comment thread src/Maui/Prism.Maui/Navigation/PageNavigationService.cs Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9a82e0aa30

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/Maui/Prism.Maui/Navigation/PageNavigationService.cs
Comment thread src/Maui/Prism.Maui/Navigation/PageNavigationService.cs Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1ed549ab21

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/Maui/Prism.Maui/Navigation/PageNavigationService.cs
Comment thread src/Maui/Prism.Maui/Navigation/PageNavigationService.cs
Comment thread src/Maui/Prism.Maui/Navigation/PageNavigationService.cs

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: db095c1445

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/Maui/Prism.Maui/Navigation/PageNavigationService.cs Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f5dd402f95

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/Maui/Prism.Maui/Navigation/PageNavigationService.cs

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4dfba4cf73

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/Maui/Prism.Maui/Navigation/PageNavigationService.cs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Support to GoBackToRoot from a Modal Context

1 participant