dotnet / dotnet/maui

WebView.CanGoBack on Windows Returns true When it Shouldn't

Open
#37,534 3 comments 1 reaction 0 assignees View on GitHub
area-webview partner/syncfusion platform/windows s/triaged s/verified t/bug
Dominant language
C#
Stars
23.3k
Forks
2k
Avg merge
1d 15h
Merged PRs (30d)
290

Description

### Description

This is a separate report of issue "d" on #10814.

The relevant code is:

``` C#
if (webView.CanGoBack)
webView.GoBack();
else
Shell.Current.Navigation.PopAsync();
```

Unfortunately, under some circumstances on Windows CanGoBack always returns true.

### Steps to Reproduce

To reproduce it use the flyout to show help, then click a link to show the index, clicking the "back" arrow will move to the initial help page as expected, but doing the same thing a second and subsequent time will just show the same help page again and again on Windows because CanGoBack always returns true.

For more detailed instructions see #10814.

### Link to public reproduction project repository

https://github.com/david-maw/MauiHelp.git

### Version with bug

11.0.0-preview.6

### Is this a regression from previous behavior?

Not sure, did not test other versions

### Last version that worked well

_No response_

### Affected platforms

Windows

### Affected platform versions

Windows 11

### Did you find any workaround?

I tested this on NET 11 Preview 7, but it's an old bug.

### Relevant log output

```shell

```

Contributor guide

Open the contributing guide

Research direction

Start with the WebView.CanGoBack, WebView.GoBack, and Shell.Current.Navigation.PopAsync entry points described in the issue, then run the linked MauiHelp reproduction on Windows 11. Reproduce the repeated back-arrow behavior and trace why CanGoBack remains true; done means back navigation returns to Shell navigation after the history is exhausted.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
desktop
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.