Repository navigation
[Windows] Fixed : WebView CanGoBack Returns true when it Shouldn't - #37648
Conversation
### Description of Change This pull request makes a minor update to the UI test pipeline configuration - Pipeline configuration simplification: * Removed the **duplicate** code that set the `$deviceType` variable and appended the `--skin` argument to the test command in `eng/pipelines/common/ui-tests-steps.yml`. The same code was already added at [line 133](https://github.com/dotnet/maui/blob/main/eng/pipelines/common/ui-tests-steps.yml#L133) as part of [PR dotnet#33409](dotnet#33409). The duplicate code was also added at [line 156](https://github.com/dotnet/maui/blob/main/eng/pipelines/common/ui-tests-steps.yml#L156) as part of [PR dotnet#31631](dotnet#31631).
<!-- 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! ### Description of Change This follow-up repairs the skill-evaluation failures exposed by dotnet#36799 and hardens the credentialed Vally evaluator so skill regressions, infrastructure failures, incomplete trials, parser differences, and reporting-side failures are classified accurately. ### Root Causes - `try-fix-capabilities` could exceed its numeric threshold while remaining red because Vally independently hard-fails execution errors and incomplete trials. Aggregate score never overrides those vetoes. - `pr-review-gh-auth` routed correctly, but its isolated fixture omitted the phase-specific unauthenticated public-GitHub fallback required by the grader. - Later failures exposed evaluator defects rather than skill regressions: PAT authentication did not prove model entitlement, model discovery did not initially match Vally 0.12's effective execution plan, matrix-only token offsets removed run-level rotation entropy, and parallel legs amplified shared PAT contention. - Run `31518503277` restored the synthetic target correctly, but one agent deleted Vally's pre-existing untracked `try-fix/` input to force an empty `git status`; Vally correctly treated that deletion as workspace drift. - Run `31524806025` completed every evaluation successfully, but a transient GitHub API fetch failure occurred before the comment step exported its already-computed verdict, making reporting red despite green suites. - Review found parser-semantic splits between Psych and Vally's pinned `yaml@2.9.0`: duplicate keys could be first-wins in AST policy checks but last-wins at runtime, while YAML merge keys/tags were interpreted differently and could hide executable evaluator fields from trusted validation. ### Changes - Replaced unreliable operational probes with bounded fixtures while preserving repeated trials, behavioral rubrics, strict thresholds, and hard-veto semantics. - Added the unauthenticated GitHub fallback fixture and deterministic skill-invocation/tool-call graders. - Upgraded to Vally 0.12 and made aggregation fail closed on execution errors, incomplete/skipped stimuli, malformed output, invocation failures, and missing mandatory coverage. - Added trusted fixture preparation plus path, symlink, Git, environment, executable, attachment, hook, settings, MCP, executor, and repository-control isolation. - Serialized matrix legs while retaining three trials per stimulus. - Made model discovery use only executed `eval*.vally.yaml` specs and Vally 0.12's effective executor and prompt-grader fields; implicit prompt-grader fallbacks are rejected. - Added model-aware PAT selection with run/rerun/matrix-distributed rotation and exact sentinel probes through the pinned evaluator runtime; reused it in the advisory soak. - Clarified that `try-fix` must preserve every pre-existing untracked path, including evaluator-loaded skill inputs. Trusted validation enforces both the skill contract and restoration fixture instruction while retaining `diff-empty` as the method-independent veto. - Exported the authoritative evaluation verdict before PR-comment API calls, added bounded API retries, and made comment publication advisory so transient GitHub failures cannot erase or invert the commit status. - Reduced soak workflow permissions to `contents: read` and made `/user` transport failures explicit without exposing PATs. - Made required-stimulus policy fail closed when a configured stimulus is renamed or removed, and bound each fixture marker/ref to the YAML stimulus that owns it so a correctly named decoy cannot satisfy the policy. - Parse each eval spec once and reject duplicate semantic mapping keys, textual YAML merge keys, and normalized explicit merge tags recursively before loading. This prevents Psych/Vally parser disagreement from bypassing prompt, ref, repository-control, or executable-environment validation. - Limited frozen-worktree test detection to full immutable commit IDs; ordinary explicit branch bases continue using authoritative PR file metadata. - Added deterministic regressions for model planning, PAT distribution and transport errors, deleted evaluator controls, host-only XAML invocation, evaluator-owned input preservation, required-stimulus rename/decoy/parser bypasses, branch-versus-immutable test detection, and reporting-side verdict preservation. ### Validation Current head: `fd8f3d543e1a1eb90e8432a0cbae07a18b52dbdd`. - Exact-head [Skill Validation run 31807806898](https://github.com/dotnet/maui/actions/runs/31807806898), [`maui-pr` build 1553690](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1553690), Build Analysis, CLA, static checks, Pester, and the hermeticity gate are green. - All evaluated suites passed. Key suites: `try-fix-restore-protocol` **1.00 / 1.00**, `try-fix-capabilities` **0.93 / 0.80**, `pr-review-gh-auth` **1.00 / 0.80**, and `verify-tests-fail-without-fix-capabilities` **0.94 / 0.87**. - Local trusted evaluator/reporting harness: **70 tests, 306 assertions, 0 failures/errors/skips**. - All **16** Vally specs pass strict lint with pinned `@microsoft/vally-cli@0.12.0`. - All **8** skill test directories pass trusted validation and resolve the effective plan to `gpt-5.6-sol` plus `claude-opus-5`; non-eval soak/hermeticity specs do not contaminate matrix selection. - Ruby syntax, Bash syntax, ShellCheck, workflow YAML parsing, Pester (**8 passed**), and `git diff --check` pass. - Final whole-diff review found no high-confidence correctness or security blockers; all review threads are resolved. - `pull_request_target` executes trusted workflow/helper code from default `main`; candidate selector/reporting helper behavior is therefore covered deterministically here and becomes the credentialed trusted path after merge. ### Issues Fixed Follow-up to dotnet#36799. --------- Co-authored-by: PureWeen <223556219+Copilot@users.noreply.github.com> Co-authored-by: Vally Fixture <vally-fixture@example.invalid> Copilot-Session: b9f7de2c-86d7-47cd-8ac8-aeff57d0b0f3 Copilot-Session: 806beb89-5041-4c7b-bcbf-998d6fbab8dc
<!-- 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! ### Description of Change Extend the existing `release-readiness` skill with deterministic, copy-ready Preview and servicing-release handoff generation from readiness JSON plus separately verified public evidence. - Keep missing or unverified release facts as explicit `TBD` values and enforce public-safe URLs, structured metadata, NuGet configuration, and Markdown output. - Correct Preview workload installation guidance with package-source mapping and the prior-major public compatibility feed while keeping workload-set packages isolated to `dotnet-workloads`. - Add focused regression coverage and run it in the release-readiness validation workflow. The renderer is a projection of the existing readiness engines rather than a second survey, so Preview and SR semantics remain distinct while sharing one public handoff format. ### Safety and Architecture - Public output requires an explicit JSON boolean `PublicEvidence: true`. - The renderer rebuilds NuGet XML from an allow-list and accepts only public `dnceng/public` Azure Artifacts feeds or the exact NuGet.org service index. - Public evidence URLs, structured build metadata, timestamps, Markdown, local paths, credential-shaped values, and owner/sign-off prose are validated or omitted. - Workload-set packages map only to `dotnet-workloads`; component and compatibility packages resolve through their appropriate public feeds. ### What Not to Do - Do not use the handoff renderer as a second readiness survey or let it select a newer build implicitly. - Do not copy private source-page content, credentials, owners, or sign-offs into public evidence. - Do not map unrelated component packages to `dotnet-workloads`; missing upstream packages can otherwise surface as misleading authorization failures. ### Validation - `pwsh -NoProfile -File .github/skills/release-readiness/tests/Test-ReleaseHandoff.ps1` - `pwsh -NoProfile -File .github/skills/release-readiness/tests/Test-ReleaseReadiness.ps1 -SkipE2E` ### Issues Fixed N/A --------- Co-authored-by: PureWeen <223556219+Copilot@users.noreply.github.com> Copilot-Session: 3db5742d-7e40-4a23-a3ea-de3bc3f0848e
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.sh | bash -s -- 37648Or
iex "& { $(irm https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.ps1) } 37648" |
|
Hey there @@SubhikshaSf4851! Thank you so much for your PR! Someone from the team will get assigned to your PR shortly and we'll get it reviewed. |
|
Azure Pipelines: Successfully started running 1 pipeline(s). There may be pipelines that require an authorized user to comment /azp run to run. |
|
/azp run maui-pr-uitests , maui-pr-devicetests |
|
Azure Pipelines: Successfully started running 2 pipeline(s). |
This comment has been minimized.
This comment has been minimized.
MauiBot
left a comment
There was a problem hiding this comment.
Expert Review — 5 findings
See inline comments for details.
MauiBot
left a comment
There was a problem hiding this comment.
AI Review Summary
@SubhikshaSf4851 — new AI review results are available based on commit
de7039f.
🗂️ Review Sessions — click to expand
🚦 Gate — Test Before & After Fix
Gate Result: ✅ PASSED
Platform: WINDOWS · Base: main · Merge base: 19a18889
| Test | Without Fix (expect FAIL) | With Fix (expect PASS) |
|---|---|---|
📱 WebViewHandlerTests (CanGoBackIsFalseAfterReturningToFirstPage) Category=WebView |
✅ FAIL — 377s | ✅ PASS — 277s |
🔴 Without fix — 📱 WebViewHandlerTests (CanGoBackIsFalseAfterReturningToFirstPage): FAIL ✅ · 377s
(no coded error found; showing last 1200 chars)
ss the warning by specifying `x:SuppressXamlTrimWarnings=True` within the closest element. If not, the property path might be trimmed and will not be AOT compatible. [D:\a\1\s\src\Controls\src\Core\Controls.Core.csproj::TargetFramework=net10.0-windows10.0.19041.0]
Platform\Windows\TabbedPage\TabbedPageStyle.xaml(13,13): XamlCompiler warning WMC1510: Ensure the property path is trimming and AOT compatible by making use of 'Compiled Bindings (x:bind)' if possible or by specifying the 'x:DataType' directive with the respective binding data context and marking the type declaration with the 'WinRT.GeneratedBindableCustomProperty' attribute or the 'Microsoft.UI.Xaml.Data.Bindable' attribute. If you are unable to do either but can ensure the data type is attributed correctly, then you can also suppress the warning by specifying `x:SuppressXamlTrimWarnings=True` within the closest element. If not, the property path might be trimmed and will not be AOT compatible. [D:\a\1\s\src\Controls\src\Core\Controls.Core.csproj::TargetFramework=net10.0-windows10.0.19041.0]
0 Error(s)
Time Elapsed 00:04:35.67
Passed: 0
Failed: 1
Skipped: 0
Total: 1
Tests completed with exit code: 1
🟢 With fix — 📱 WebViewHandlerTests (CanGoBackIsFalseAfterReturningToFirstPage): PASS ✅ · 277s
(no coded error found; showing last 1200 chars)
uppress the warning by specifying `x:SuppressXamlTrimWarnings=True` within the closest element. If not, the property path might be trimmed and will not be AOT compatible. [D:\a\1\s\src\Controls\src\Core\Controls.Core.csproj::TargetFramework=net10.0-windows10.0.19041.0]
Platform\Windows\TabbedPage\TabbedPageStyle.xaml(13,13): XamlCompiler warning WMC1510: Ensure the property path is trimming and AOT compatible by making use of 'Compiled Bindings (x:bind)' if possible or by specifying the 'x:DataType' directive with the respective binding data context and marking the type declaration with the 'WinRT.GeneratedBindableCustomProperty' attribute or the 'Microsoft.UI.Xaml.Data.Bindable' attribute. If you are unable to do either but can ensure the data type is attributed correctly, then you can also suppress the warning by specifying `x:SuppressXamlTrimWarnings=True` within the closest element. If not, the property path might be trimmed and will not be AOT compatible. [D:\a\1\s\src\Controls\src\Core\Controls.Core.csproj::TargetFramework=net10.0-windows10.0.19041.0]
0 Error(s)
Time Elapsed 00:04:22.66
Passed: 1
Failed: 0
Skipped: 0
Total: 1
Tests completed successfully
📁 Fix files reverted (2 files)
src/Core/src/Handlers/WebView/WebViewHandler.Windows.cssrc/Core/src/Platform/Windows/WebViewExtensions.cs
📋 Pre-Flight — Context & Validation
PR #37648 Pre-Flight
Context
- PR:
[WIP][Windows] Fixed : WebView CanGoBack Returns true when it Shouldn't - Issue: #37534,
WebView.CanGoBack on Windows Returns true When it Shouldn't - Platform: Windows 11 / Windows WebView2
- Problem: After navigating from an initial WebView page to a second page and then back to the first page,
IWebView.CanGoBackcan remaintrue. Application code then callsGoBack()repeatedly instead of falling back to app-level navigation. - Base / merge base:
main/19a188896c0e518c0d201db181f67166c740724d - Materialized PR commit:
ffa08dd4723068a338f6f42b0ad67847c0ac767b
Existing PR Approach
The PR changes:
src/Core/src/Handlers/WebView/WebViewHandler.Windows.csMapGoBackandMapGoForwardpreferCoreWebView2.CanGoBack/CanGoForwardover the WebView2 control wrapper properties before settingCurrentNavigationEvent.- Both mappers cache and null-check
PlatformView.
src/Core/src/Platform/Windows/WebViewExtensions.csUpdateCanGoBackForwardprefers the underlyingCoreWebView2history values and falls back to the WebView2 control properties before core initialization.
src/Core/tests/DeviceTests/Handlers/WebView/WebViewHandlerTests.Windows.cs- Adds
CanGoBackIsFalseAfterReturningToFirstPage, which loads two HTML pages, navigates back, and assertsCanGoBack == false.
- Adds
The existing fix assumes the WinUI WebView2.CanGoBack / CanGoForward wrapper values are stale while the underlying CoreWebView2 values are current.
Validation Contract
The prior gate already proved the regression test fails without the production fix and passes with it:
- Without fix: 0 passed, 1 failed
- With fix: 1 passed, 0 failed
- Primary command:
pwsh .github/skills/run-device-tests/scripts/Run-DeviceTests.ps1 -Project Core -Platform windows -TestFilter "Category=WebView" -Rebuild - No additional mandatory regression test was supplied for STEP 5a; do not run a full suite.
- Do not repeat the separate gate A/B verification.
Candidate Boundaries
- Each candidate must use a root-cause mechanism different from the PR fix and from earlier candidates.
- Production files eligible for baseline restoration and modification:
src/Core/src/Handlers/WebView/WebViewHandler.Windows.cssrc/Core/src/Platform/Windows/WebViewExtensions.cs
- The added regression test remains in place but is read-only for try-fix.
- Preserve all unrelated pre-existing tracked and untracked worktree changes.
- Use only
pwsh .github/scripts/EstablishBrokenBaseline.ps1and its exact-Restoremode for baseline handling. - One implementation/test pass is allowed, plus at most one focused correction/retest.
Pre-Flight Result
Ready for two sequential bounded try-fix attempts. Gate verification is accepted and must not be rerun.
🔬 Code Review — Deep Analysis
Expert PR Evaluation — PR #37648
Verdict: Approve with non-blocking hardening changes
Confidence: High for the production mechanism; medium for long-term test stability.
Independent Assessment
The Windows handler now uses CoreWebView2.CanGoBack and CoreWebView2.CanGoForward as the authoritative navigation-history state, with the WinUI WebView2 wrapper properties as a pre-initialization fallback. The same source is used both when publishing IWebView state and when deciding whether GoBack/GoForward can execute. The added Windows device test covers returning from a second HTML page to the first page.
This is the correct root-cause mechanism. STEP 5a candidate 1 showed that republishing the wrapper properties later does not repair their stale state, while candidate 2's handler-owned counters cannot faithfully represent WebView2 joint-session history such as history.pushState() and script-initiated navigation.
Findings
- Moderate — disposed
CoreWebView2access:UpdateCanGoBackForwardnow readsCoreWebView2directly even though this file'sIsValid()helper documents that the access can throw afterWebView2.Close(). A delayedSendNavigatedcontinuation or late source update can reach this path after disconnect. Guard the read withIsValid(). - Moderate — incomplete pre-initialization guard:
MapGoBackandMapGoForwardnull-checkPlatformView, butUpdateGoBackandUpdateGoForwardstill dereference a nullCoreWebView2. Guard the core before calling those helpers; the wrapper fallback is not useful before core initialization. - Moderate — initial-navigation test race: the test subscribes after handler creation may already have started the first navigation. Register the callback and trigger a fresh source update after subscription.
- Moderate — assertion timing race:
NavigatedDelegatecompletes beforeSendNavigatedcallsUpdateCanGoBackForward, so the test can resume before the state under test is published. Use asynchronous continuations and wait for the expected state. - Minor — dead local: remove the unused
platformViewlocal from the new test.
The raw inline findings are recorded in ../inline-findings.json.
Blast Radius and Failure Modes
The production change is localized to Windows WebView; it does not affect startup, static/shared state, public API, trimming, or other platforms. It runs for every Windows WebView navigation-state update. Pre-core initialization remains safe in UpdateCanGoBackForward, but command mapping still needs the core guard noted above. The new direct core access introduces a post-Close() risk unless routed through IsValid(). Using WebView2's own history state correctly covers script-driven history mutations that a parallel MAUI counter would miss.
Prior Review and CI
The three GitHub review surfaces could not be queried because gh is unauthenticated; no prior error finding is present in the supplied local artifacts. The trusted gate passed: the regression test fails without the production fix and passes with it. The focused STEP 5a Windows WebView run also completed with 1,981 passed, 111 skipped, and no failures for the candidate that retained the regression test.
🛠️ Try-Fix — Analysis & Comparison
Alternative Fix Candidates — PR #37648
Candidate 1 — Navigation-State Publication Ordering
Model: claude-opus-5
Result: FAIL
Artifacts: CustomAgentLogsTmp/PRState/37648/PRAgent/try-fix-1/content.md
The candidate refreshed the existing WinUI WebView2 wrapper history properties before Navigated, testing whether consumers merely observed a one-event-old value. The focused Windows Category=WebView run built and deployed successfully, but CanGoBackIsFalseAfterReturningToFirstPage remained the sole failure. This disproves the timing-only hypothesis: WebView2.CanGoBack itself is still stale at navigation completion. Candidate 2 must avoid both wrapper-state resampling and the PR's direct CoreWebView2 state-source swap.
Candidate 2 — Handler-Owned Navigation History
Model: gpt-5.6-sol
Result: FAIL
Artifacts: CustomAgentLogsTmp/PRState/37648/PRAgent/try-fix-2/content.md
The candidate independently tracked successful NewPage/Back/Forward transitions and derived navigation availability without either platform property source. After one focused correction, the same Windows Category=WebView command passed all 2,092 discovered tests (1,981 passed, 111 skipped). It was nevertheless rejected because inline expert review found a major untested correctness gap: WebView2 history.pushState() changes and script-initiated history navigation can bypass NavigationCompleted or MAUI command mappers, causing the handler-owned counters to diverge and suppress valid navigation.
Aggregate Assessment
Neither alternative is safe:
- Publication reordering fails the primary regression because the WinUI wrapper remains stale even at navigation completion.
- Handler-owned bookkeeping passes the regression but cannot faithfully model WebView2 joint-session history.
Together, the attempts strengthen the existing PR's root-cause choice: the underlying CoreWebView2 history state is required as the authoritative source rather than timing changes or a parallel history model.
📝 PR Finalize — Recommended Title & Description
Assessment: ✏️ Recommend updating — the description is accurate and detailed, but the title contains a stale [WIP] marker and does not follow the platform/component/action format.
Recommended title
[Windows] WebView: Fix stale CanGoBack and CanGoForward state
Recommended description
This pull request fixes stale `CanGoBack` and `CanGoForward` values in the Windows WebView handler so application navigation decisions reflect the current WebView2 history. It also adds a regression test for returning to the first page.
### Description of Change
The WinUI `WebView2.CanGoBack` and `WebView2.CanGoForward` wrapper properties can remain stale after navigation. The underlying `CoreWebView2.CanGoBack` and `CoreWebView2.CanGoForward` properties reflect the current navigation state.
**Fixes and improvements to WebView navigation state:**
* Updated `WebViewHandler.Windows.cs` so `MapGoBack` and `MapGoForward` prefer `CoreWebView2.CanGoBack` and `CoreWebView2.CanGoForward` before setting the current navigation event, with the WebView2 control properties retained as a fallback before core initialization.
* Updated `WebViewExtensions.UpdateCanGoBackForward` to prefer the `CoreWebView2` navigation state when publishing `CanGoBack` and `CanGoForward`, with the WebView2 control properties retained as a fallback before core initialization.
**Testing and regression prevention:**
* Added `CanGoBackIsFalseAfterReturningToFirstPage`, which loads two HTML pages, navigates back to the first page, and verifies that `CanGoBack` becomes `false`.
### Issues Fixed
Fixes #37534
### Tested the behavior in the following platforms
- [x] Windows
- [ ] Android
- [ ] iOS
- [ ] Mac
| Before Issue Fix | After Issue Fix |
|----------|----------|
| <video src="https://github.com/user-attachments/assets/c6c4e68b-21ac-49cd-ad96-3f628c889674"> | <video src="https://github.com/user-attachments/assets/1a0fcee7-32d4-42a6-8003-25b89087e580"> |
🏁 Report — Final Recommendation
✅ Final Recommendation: APPROVE
Winner: pr
The submitted PR uses the correct Windows WebView2 source of truth and is the only candidate that combines a sound history model with trusted A/B regression evidence: the added test fails without the fix and passes with it. Expert review found useful lifecycle and test-stability hardening opportunities, but classified them as non-blocking; the one permitted pr-plus-reviewer implementation did not compile and therefore cannot replace the validated submission.
Comparative Ranking
| Rank | Candidate | Validation | Correctness assessment |
|---|---|---|---|
| 1 | pr |
PASS — trusted Gate: regression fails without the fix and passes with it | Uses CoreWebView2.CanGoBack / CanGoForward, which accurately reflects the browser's joint-session history. No blocking expert finding. |
| 2 | try-fix-2 |
PASS — 1,981 passed, 111 skipped, 0 failed | Rejected despite passing the regression: handler-owned counters diverge for history.pushState() and script-initiated navigation and can suppress valid navigation. |
| 3 | pr-plus-reviewer |
FAIL/BLOCKED BEFORE TESTS — candidate build reported CS0103 for unavailable AssertEventually and WMC0001 for MiddleApp |
Preserves the PR's correct mechanism and adds worthwhile lifecycle/test hardening, but the submitted refinement is not buildable and has no passing regression result. No repair/retest loop was permitted. |
| 4 | try-fix-1 |
FAIL — regression remained the sole failed test (1,980 passed, 111 skipped) | Republishing WinUI wrapper state later does not help because the wrapper property itself remains stale. |
Expert Findings on the Submitted PR
UpdateCanGoBackForwarddirectly readsCoreWebView2on paths that may resume afterWebView2.Close(); the existingIsValid()guard would harden this.- command mapping guards
PlatformViewbut not an uninitialized/disposedCoreWebView2; - the regression test can miss the initial navigation callback and can observe state before the post-
Navigatedupdate; - the new test contains an unused local.
These are follow-up hardening and test-reliability improvements rather than evidence that the chosen production mechanism is wrong. The change is Windows-only, introduces no public API or shared/static state, and moves Windows behavior toward the live platform history semantics already expected by IWebView.
Decision
Approve the raw PR candidate. It satisfies the trusted Gate and is safer than both alternative mechanisms. The failed pr-plus-reviewer validation is recorded in pr-plus-reviewer/validation.log; its changes are not recommended as the winning patch in their current form.
📱 UI Tests — ViewBaseTests
Detected UI test categories: ViewBaseTests
[!WARNING]
No UI test results were produced for the detected categories. The PR build itself was
fine — the deep UI stage was skipped or interrupted on infrastructure (the
merge-for-testing step, emulator/simulator boot, or an Appium hang), not by this PR's code.
This is usually transient; the review re-runs on new commits (a maintainer can also re-run it).
🧭 Next Steps — review latest findings
No alternative fix was selected for this run. Review the session findings and CI results before merging.
|
Azure Pipelines: Successfully started running 1 pipeline(s). There may be pipelines that require an authorized user to comment /azp run to run. |
There was a problem hiding this comment.
Pull request overview
This PR updates the Windows WebView handler/navigation-state plumbing to avoid stale CanGoBack/CanGoForward values by preferring CoreWebView2’s navigation state, and adds a Windows device test intended to prevent regressions around back-history state.
Changes:
- Prefer
CoreWebView2state (when available) forCanGoBack/CanGoForwardupdates in WindowsWebView2integration. - Adjust Windows WebView handler command mappers (
GoBack/GoForward) to consultCoreWebView2state rather than relying on potentially stale control properties. - Add a Windows device test covering
CanGoBackbecomingfalseagain after returning to the first page.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| src/Core/tests/DeviceTests/Handlers/WebView/WebViewHandlerTests.Windows.cs | Adds a Windows regression test for CanGoBack correctness after navigating back to the first page. |
| src/Core/src/Platform/Windows/WebViewExtensions.cs | Updates navigation helpers to use IsValid() and prefer CoreWebView2 for CanGoBack/CanGoForward synchronization. |
| src/Core/src/Handlers/WebView/WebViewHandler.Windows.cs | Updates Windows handler command mapping to use CoreWebView2 navigation state when setting navigation event context. |
| // Use CoreWebView2.CanGoForward rather than the WebView2 control's CanGoForward, | ||
| // which can be stale (see UpdateCanGoBackForward). | ||
| if ((platformView.CoreWebView2?.CanGoForward ?? platformView.CanGoForward) && handler is WebViewHandler w) | ||
| { | ||
| w.CurrentNavigationEvent = WebNavigationEvent.Forward; | ||
| } |
| // Use CoreWebView2.CanGoBack rather than the WebView2 control's CanGoBack, | ||
| // which can be stale (see UpdateCanGoBackForward). | ||
| if ((platformView.CoreWebView2?.CanGoBack ?? platformView.CanGoBack) && handler is WebViewHandler w) | ||
| { | ||
| w.CurrentNavigationEvent = WebNavigationEvent.Back; | ||
| } |
| var handler = CreateHandler(webView); | ||
|
|
||
| var platformView = handler.PlatformView; | ||
|
|
Skill Validation Results
❌ Skill Validation Results —
|
…37648) <!-- Please keep the note below for people who 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 whether this change resolves your issue. Thank you! This pull request addresses issues with the accuracy of the `CanGoBack` and `CanGoForward` properties in the Windows WebView handler, ensuring that navigation state is correctly reflected and not stale. It also adds a regression test to prevent future issues with navigation history. ### Description of Change **Fixes and improvements to WebView navigation state:** * Updated the logic in `WebViewHandler.Windows.cs` to check `CoreWebView2.CanGoBack` and `CoreWebView2.CanGoForward` instead of relying solely on the WebView2 control properties, which could become stale and cause incorrect navigation behavior. * Enhanced the `UpdateCanGoBackForward` extension method in `WebViewExtensions.cs` to prefer the `CoreWebView2` navigation state for `CanGoBack` and `CanGoForward`, falling back to the control's properties only when necessary. **Testing and regression prevention:** * Added a new test, `CanGoBackIsFalseAfterReturningToFirstPage`, to verify that `CanGoBack` is set to false after navigating back to the first page, preventing regressions related to navigation history. <!-- Enter description of the fix in this section --> ### 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. --> Fixes #37534 ### Tested the behavior in the following platforms - [x] Windows - [ ] Android - [ ] iOS - [ ] Mac | Before Issue Fix | After Issue Fix | |----------|----------| | <video src="https://github.com/user-attachments/assets/c6c4e68b-21ac-49cd-ad96-3f628c889674"> | <video src="https://github.com/user-attachments/assets/1a0fcee7-32d4-42a6-8003-25b89087e580"> | <!-- Are you targeting main? All PRs should target the main branch unless otherwise noted. --> ---------
…37648) <!-- Please keep the note below for people who 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 whether this change resolves your issue. Thank you! This pull request addresses issues with the accuracy of the `CanGoBack` and `CanGoForward` properties in the Windows WebView handler, ensuring that navigation state is correctly reflected and not stale. It also adds a regression test to prevent future issues with navigation history. ### Description of Change **Fixes and improvements to WebView navigation state:** * Updated the logic in `WebViewHandler.Windows.cs` to check `CoreWebView2.CanGoBack` and `CoreWebView2.CanGoForward` instead of relying solely on the WebView2 control properties, which could become stale and cause incorrect navigation behavior. * Enhanced the `UpdateCanGoBackForward` extension method in `WebViewExtensions.cs` to prefer the `CoreWebView2` navigation state for `CanGoBack` and `CanGoForward`, falling back to the control's properties only when necessary. **Testing and regression prevention:** * Added a new test, `CanGoBackIsFalseAfterReturningToFirstPage`, to verify that `CanGoBack` is set to false after navigating back to the first page, preventing regressions related to navigation history. <!-- Enter description of the fix in this section --> ### 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. --> Fixes #37534 ### Tested the behavior in the following platforms - [x] Windows - [ ] Android - [ ] iOS - [ ] Mac | Before Issue Fix | After Issue Fix | |----------|----------| | <video src="https://github.com/user-attachments/assets/c6c4e68b-21ac-49cd-ad96-3f628c889674"> | <video src="https://github.com/user-attachments/assets/1a0fcee7-32d4-42a6-8003-25b89087e580"> | <!-- Are you targeting main? All PRs should target the main branch unless otherwise noted. --> ---------
…37648) <!-- Please keep the note below for people who 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 whether this change resolves your issue. Thank you! This pull request addresses issues with the accuracy of the `CanGoBack` and `CanGoForward` properties in the Windows WebView handler, ensuring that navigation state is correctly reflected and not stale. It also adds a regression test to prevent future issues with navigation history. ### Description of Change **Fixes and improvements to WebView navigation state:** * Updated the logic in `WebViewHandler.Windows.cs` to check `CoreWebView2.CanGoBack` and `CoreWebView2.CanGoForward` instead of relying solely on the WebView2 control properties, which could become stale and cause incorrect navigation behavior. * Enhanced the `UpdateCanGoBackForward` extension method in `WebViewExtensions.cs` to prefer the `CoreWebView2` navigation state for `CanGoBack` and `CanGoForward`, falling back to the control's properties only when necessary. **Testing and regression prevention:** * Added a new test, `CanGoBackIsFalseAfterReturningToFirstPage`, to verify that `CanGoBack` is set to false after navigating back to the first page, preventing regressions related to navigation history. <!-- Enter description of the fix in this section --> ### 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. --> Fixes #37534 ### Tested the behavior in the following platforms - [x] Windows - [ ] Android - [ ] iOS - [ ] Mac | Before Issue Fix | After Issue Fix | |----------|----------| | <video src="https://github.com/user-attachments/assets/c6c4e68b-21ac-49cd-ad96-3f628c889674"> | <video src="https://github.com/user-attachments/assets/1a0fcee7-32d4-42a6-8003-25b89087e580"> | <!-- Are you targeting main? All PRs should target the main branch unless otherwise noted. --> ---------
…37648) <!-- Please keep the note below for people who 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 whether this change resolves your issue. Thank you! This pull request addresses issues with the accuracy of the `CanGoBack` and `CanGoForward` properties in the Windows WebView handler, ensuring that navigation state is correctly reflected and not stale. It also adds a regression test to prevent future issues with navigation history. ### Description of Change **Fixes and improvements to WebView navigation state:** * Updated the logic in `WebViewHandler.Windows.cs` to check `CoreWebView2.CanGoBack` and `CoreWebView2.CanGoForward` instead of relying solely on the WebView2 control properties, which could become stale and cause incorrect navigation behavior. * Enhanced the `UpdateCanGoBackForward` extension method in `WebViewExtensions.cs` to prefer the `CoreWebView2` navigation state for `CanGoBack` and `CanGoForward`, falling back to the control's properties only when necessary. **Testing and regression prevention:** * Added a new test, `CanGoBackIsFalseAfterReturningToFirstPage`, to verify that `CanGoBack` is set to false after navigating back to the first page, preventing regressions related to navigation history. <!-- Enter description of the fix in this section --> ### 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. --> Fixes #37534 ### Tested the behavior in the following platforms - [x] Windows - [ ] Android - [ ] iOS - [ ] Mac | Before Issue Fix | After Issue Fix | |----------|----------| | <video src="https://github.com/user-attachments/assets/c6c4e68b-21ac-49cd-ad96-3f628c889674"> | <video src="https://github.com/user-attachments/assets/1a0fcee7-32d4-42a6-8003-25b89087e580"> | <!-- Are you targeting main? All PRs should target the main branch unless otherwise noted. --> ---------
…37648) <!-- Please keep the note below for people who 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 whether this change resolves your issue. Thank you! This pull request addresses issues with the accuracy of the `CanGoBack` and `CanGoForward` properties in the Windows WebView handler, ensuring that navigation state is correctly reflected and not stale. It also adds a regression test to prevent future issues with navigation history. ### Description of Change **Fixes and improvements to WebView navigation state:** * Updated the logic in `WebViewHandler.Windows.cs` to check `CoreWebView2.CanGoBack` and `CoreWebView2.CanGoForward` instead of relying solely on the WebView2 control properties, which could become stale and cause incorrect navigation behavior. * Enhanced the `UpdateCanGoBackForward` extension method in `WebViewExtensions.cs` to prefer the `CoreWebView2` navigation state for `CanGoBack` and `CanGoForward`, falling back to the control's properties only when necessary. **Testing and regression prevention:** * Added a new test, `CanGoBackIsFalseAfterReturningToFirstPage`, to verify that `CanGoBack` is set to false after navigating back to the first page, preventing regressions related to navigation history. <!-- Enter description of the fix in this section --> ### 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. --> Fixes #37534 ### Tested the behavior in the following platforms - [x] Windows - [ ] Android - [ ] iOS - [ ] Mac | Before Issue Fix | After Issue Fix | |----------|----------| | <video src="https://github.com/user-attachments/assets/c6c4e68b-21ac-49cd-ad96-3f628c889674"> | <video src="https://github.com/user-attachments/assets/1a0fcee7-32d4-42a6-8003-25b89087e580"> | <!-- Are you targeting main? All PRs should target the main branch unless otherwise noted. --> ---------
…37648) <!-- Please keep the note below for people who 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 whether this change resolves your issue. Thank you! This pull request addresses issues with the accuracy of the `CanGoBack` and `CanGoForward` properties in the Windows WebView handler, ensuring that navigation state is correctly reflected and not stale. It also adds a regression test to prevent future issues with navigation history. ### Description of Change **Fixes and improvements to WebView navigation state:** * Updated the logic in `WebViewHandler.Windows.cs` to check `CoreWebView2.CanGoBack` and `CoreWebView2.CanGoForward` instead of relying solely on the WebView2 control properties, which could become stale and cause incorrect navigation behavior. * Enhanced the `UpdateCanGoBackForward` extension method in `WebViewExtensions.cs` to prefer the `CoreWebView2` navigation state for `CanGoBack` and `CanGoForward`, falling back to the control's properties only when necessary. **Testing and regression prevention:** * Added a new test, `CanGoBackIsFalseAfterReturningToFirstPage`, to verify that `CanGoBack` is set to false after navigating back to the first page, preventing regressions related to navigation history. <!-- Enter description of the fix in this section --> ### 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. --> Fixes #37534 ### Tested the behavior in the following platforms - [x] Windows - [ ] Android - [ ] iOS - [ ] Mac | Before Issue Fix | After Issue Fix | |----------|----------| | <video src="https://github.com/user-attachments/assets/c6c4e68b-21ac-49cd-ad96-3f628c889674"> | <video src="https://github.com/user-attachments/assets/1a0fcee7-32d4-42a6-8003-25b89087e580"> | <!-- Are you targeting main? All PRs should target the main branch unless otherwise noted. --> ---------
…37648) <!-- Please keep the note below for people who 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 whether this change resolves your issue. Thank you! This pull request addresses issues with the accuracy of the `CanGoBack` and `CanGoForward` properties in the Windows WebView handler, ensuring that navigation state is correctly reflected and not stale. It also adds a regression test to prevent future issues with navigation history. ### Description of Change **Fixes and improvements to WebView navigation state:** * Updated the logic in `WebViewHandler.Windows.cs` to check `CoreWebView2.CanGoBack` and `CoreWebView2.CanGoForward` instead of relying solely on the WebView2 control properties, which could become stale and cause incorrect navigation behavior. * Enhanced the `UpdateCanGoBackForward` extension method in `WebViewExtensions.cs` to prefer the `CoreWebView2` navigation state for `CanGoBack` and `CanGoForward`, falling back to the control's properties only when necessary. **Testing and regression prevention:** * Added a new test, `CanGoBackIsFalseAfterReturningToFirstPage`, to verify that `CanGoBack` is set to false after navigating back to the first page, preventing regressions related to navigation history. <!-- Enter description of the fix in this section --> ### 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. --> Fixes #37534 ### Tested the behavior in the following platforms - [x] Windows - [ ] Android - [ ] iOS - [ ] Mac | Before Issue Fix | After Issue Fix | |----------|----------| | <video src="https://github.com/user-attachments/assets/c6c4e68b-21ac-49cd-ad96-3f628c889674"> | <video src="https://github.com/user-attachments/assets/1a0fcee7-32d4-42a6-8003-25b89087e580"> | <!-- Are you targeting main? All PRs should target the main branch unless otherwise noted. --> ---------
…37648) <!-- Please keep the note below for people who 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 whether this change resolves your issue. Thank you! This pull request addresses issues with the accuracy of the `CanGoBack` and `CanGoForward` properties in the Windows WebView handler, ensuring that navigation state is correctly reflected and not stale. It also adds a regression test to prevent future issues with navigation history. ### Description of Change **Fixes and improvements to WebView navigation state:** * Updated the logic in `WebViewHandler.Windows.cs` to check `CoreWebView2.CanGoBack` and `CoreWebView2.CanGoForward` instead of relying solely on the WebView2 control properties, which could become stale and cause incorrect navigation behavior. * Enhanced the `UpdateCanGoBackForward` extension method in `WebViewExtensions.cs` to prefer the `CoreWebView2` navigation state for `CanGoBack` and `CanGoForward`, falling back to the control's properties only when necessary. **Testing and regression prevention:** * Added a new test, `CanGoBackIsFalseAfterReturningToFirstPage`, to verify that `CanGoBack` is set to false after navigating back to the first page, preventing regressions related to navigation history. <!-- Enter description of the fix in this section --> ### 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. --> Fixes #37534 ### Tested the behavior in the following platforms - [x] Windows - [ ] Android - [ ] iOS - [ ] Mac | Before Issue Fix | After Issue Fix | |----------|----------| | <video src="https://github.com/user-attachments/assets/c6c4e68b-21ac-49cd-ad96-3f628c889674"> | <video src="https://github.com/user-attachments/assets/1a0fcee7-32d4-42a6-8003-25b89087e580"> | <!-- Are you targeting main? All PRs should target the main branch unless otherwise noted. --> ---------
…37648) <!-- Please keep the note below for people who 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 whether this change resolves your issue. Thank you! This pull request addresses issues with the accuracy of the `CanGoBack` and `CanGoForward` properties in the Windows WebView handler, ensuring that navigation state is correctly reflected and not stale. It also adds a regression test to prevent future issues with navigation history. ### Description of Change **Fixes and improvements to WebView navigation state:** * Updated the logic in `WebViewHandler.Windows.cs` to check `CoreWebView2.CanGoBack` and `CoreWebView2.CanGoForward` instead of relying solely on the WebView2 control properties, which could become stale and cause incorrect navigation behavior. * Enhanced the `UpdateCanGoBackForward` extension method in `WebViewExtensions.cs` to prefer the `CoreWebView2` navigation state for `CanGoBack` and `CanGoForward`, falling back to the control's properties only when necessary. **Testing and regression prevention:** * Added a new test, `CanGoBackIsFalseAfterReturningToFirstPage`, to verify that `CanGoBack` is set to false after navigating back to the first page, preventing regressions related to navigation history. <!-- Enter description of the fix in this section --> ### 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. --> Fixes #37534 ### Tested the behavior in the following platforms - [x] Windows - [ ] Android - [ ] iOS - [ ] Mac | Before Issue Fix | After Issue Fix | |----------|----------| | <video src="https://github.com/user-attachments/assets/c6c4e68b-21ac-49cd-ad96-3f628c889674"> | <video src="https://github.com/user-attachments/assets/1a0fcee7-32d4-42a6-8003-25b89087e580"> | <!-- Are you targeting main? All PRs should target the main branch unless otherwise noted. --> ---------
…37648) <!-- Please keep the note below for people who 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 whether this change resolves your issue. Thank you! This pull request addresses issues with the accuracy of the `CanGoBack` and `CanGoForward` properties in the Windows WebView handler, ensuring that navigation state is correctly reflected and not stale. It also adds a regression test to prevent future issues with navigation history. ### Description of Change **Fixes and improvements to WebView navigation state:** * Updated the logic in `WebViewHandler.Windows.cs` to check `CoreWebView2.CanGoBack` and `CoreWebView2.CanGoForward` instead of relying solely on the WebView2 control properties, which could become stale and cause incorrect navigation behavior. * Enhanced the `UpdateCanGoBackForward` extension method in `WebViewExtensions.cs` to prefer the `CoreWebView2` navigation state for `CanGoBack` and `CanGoForward`, falling back to the control's properties only when necessary. **Testing and regression prevention:** * Added a new test, `CanGoBackIsFalseAfterReturningToFirstPage`, to verify that `CanGoBack` is set to false after navigating back to the first page, preventing regressions related to navigation history. <!-- Enter description of the fix in this section --> ### 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. --> Fixes #37534 ### Tested the behavior in the following platforms - [x] Windows - [ ] Android - [ ] iOS - [ ] Mac | Before Issue Fix | After Issue Fix | |----------|----------| | <video src="https://github.com/user-attachments/assets/c6c4e68b-21ac-49cd-ad96-3f628c889674"> | <video src="https://github.com/user-attachments/assets/1a0fcee7-32d4-42a6-8003-25b89087e580"> | <!-- Are you targeting main? All PRs should target the main branch unless otherwise noted. --> ---------
…37648) <!-- Please keep the note below for people who 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 whether this change resolves your issue. Thank you! This pull request addresses issues with the accuracy of the `CanGoBack` and `CanGoForward` properties in the Windows WebView handler, ensuring that navigation state is correctly reflected and not stale. It also adds a regression test to prevent future issues with navigation history. ### Description of Change **Fixes and improvements to WebView navigation state:** * Updated the logic in `WebViewHandler.Windows.cs` to check `CoreWebView2.CanGoBack` and `CoreWebView2.CanGoForward` instead of relying solely on the WebView2 control properties, which could become stale and cause incorrect navigation behavior. * Enhanced the `UpdateCanGoBackForward` extension method in `WebViewExtensions.cs` to prefer the `CoreWebView2` navigation state for `CanGoBack` and `CanGoForward`, falling back to the control's properties only when necessary. **Testing and regression prevention:** * Added a new test, `CanGoBackIsFalseAfterReturningToFirstPage`, to verify that `CanGoBack` is set to false after navigating back to the first page, preventing regressions related to navigation history. <!-- Enter description of the fix in this section --> ### 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. --> Fixes #37534 ### Tested the behavior in the following platforms - [x] Windows - [ ] Android - [ ] iOS - [ ] Mac | Before Issue Fix | After Issue Fix | |----------|----------| | <video src="https://github.com/user-attachments/assets/c6c4e68b-21ac-49cd-ad96-3f628c889674"> | <video src="https://github.com/user-attachments/assets/1a0fcee7-32d4-42a6-8003-25b89087e580"> | <!-- Are you targeting main? All PRs should target the main branch unless otherwise noted. --> ---------
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 from this PR and let us know in a comment whether this change resolves your issue. Thank you!
This pull request addresses issues with the accuracy of the
CanGoBackandCanGoForwardproperties in the Windows WebView handler, ensuring that navigation state is correctly reflected and not stale. It also adds a regression test to prevent future issues with navigation history.Description of Change
Fixes and improvements to WebView navigation state:
WebViewHandler.Windows.csto checkCoreWebView2.CanGoBackandCoreWebView2.CanGoForwardinstead of relying solely on the WebView2 control properties, which could become stale and cause incorrect navigation behavior.UpdateCanGoBackForwardextension method inWebViewExtensions.csto prefer theCoreWebView2navigation state forCanGoBackandCanGoForward, falling back to the control's properties only when necessary.Testing and regression prevention:
CanGoBackIsFalseAfterReturningToFirstPage, to verify thatCanGoBackis set to false after navigating back to the first page, preventing regressions related to navigation history.Issues Fixed
Fixes #37534
Tested the behavior in the following platforms
BeforeFix37534.mp4
AfterFix37534.mp4