Bug 35489 - Webview loses navigation history when in masterdetailpage
Summary: Webview loses navigation history when in masterdetailpage
Status: RESOLVED NOT_ON_ROADMAP
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: 1.5.1
Hardware: All Mac OS
: Normal enhancement
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2015-11-03 04:22 UTC by Lewis Todd
Modified: 2017-06-19 14:46 UTC (History)
6 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:


Attachments
Sample project (222.69 KB, application/zip)
2016-01-12 14:05 UTC, Lewis Todd
Details


Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED NOT_ON_ROADMAP

Description Lewis Todd 2015-11-03 04:22:32 UTC
Place a view which contains a web view in the detail page of a master detail page - perform some navigation in the web view that would enable the go forward/back methods on the webview. Switch the content of the detail page (as you would from a flyout menu), then switch back to the original page.  The page will be at the same page you last navigated to but the navigation history will be lost.

This is a regression as it used to work in a previous version of forms, I think the issue is that the renderers are now disposed when the detail pane is switched which means a new native web view is created.
Comment 1 Naqeeb 2016-01-12 13:50:58 UTC
I have tried to reproduce this issue but not able to reproduce it.

Could you provide a sample, ide log and environment info, so we can reproduce this issue at our end.

You can get Ide log via Help -> Open Log Directory and Environment info via Xamarin Studio -> About Xamarin Studio -> Show Details
Comment 2 Lewis Todd 2016-01-12 14:05:20 UTC
Created attachment 14554 [details]
Sample project
Comment 3 Lewis Todd 2016-01-12 14:05:30 UTC
Steps to reproduce:
-Open app(i've been testing on android).
-Open the flyout menu select "Web View". Bbc news homepage will be loaded
-select a story -> navigates into page(observe forward/back behaviour then works)
-Use fly out menu, navigate back to original page. 
-Use flyout again to navigate back into web view page.
-Forward/back buttons no longer work as history is lost(renderer has recreated the native control i think).

Prior to XF 1.5.1 this worked. (you can download the older nuget package to verify).
Comment 4 Lewis Todd 2016-01-12 14:10:53 UTC
Environment Info:
Xamarin Studio
Version 5.10.1 (build 6)
Installation UUID: fcc1541f-eb9f-4db6-9b47-82298496eeb3
Runtime:
	Mono 4.2.1 (explicit/6dd2d0d)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 402010102

Xamarin.Profiler
Not Installed

Apple Developer Tools
Xcode 7.2 (9548)
Build 7C68

Xamarin.iOS
Version: 9.4.0.0 (Enterprise Edition)
Hash: 7322991
Branch: master
Build date: 2015-12-08 16:20:29-0500

Xamarin.Android
Version: 6.0.0.34 (Enterprise Edition)
Android SDK: /Users/xxxxxx/Library/Developer/Xamarin/android-sdk-macosx
	Supported Android versions:
		2.3   (API level 10)
		4.0.3 (API level 15)
		4.1   (API level 16)
		4.4   (API level 19)
		5.0   (API level 21)
		5.1   (API level 22)
		6.0   (API level 23)

SDK Tools Version: 24.4.1
SDK Platform Tools Version: 23.0.1
SDK Build Tools Version: 20.0.0

Java SDK: /usr
java version "1.6.0_65"
Java(TM) SE Runtime Environment (build 1.6.0_65-b14-466.1-11M4716)
Java HotSpot(TM) 64-Bit Server VM (build 20.65-b04-466.1, mixed mode)

Xamarin Android Player
Version: 0.6.5
Location: /Applications/Xamarin Android Player.app

Xamarin.Mac
Not Installed

Build Information
Release ID: 510010006
Git revision: 0b60eecdb531933734519c13257d16a780274aab
Build date: 2015-12-04 20:28:20-05
Xamarin addins: 9876fd7c9837977178411ec7375b4352c0a0d6af
Build lane: monodevelop-lion-cycle6-baseline

Operating System
Mac OS X 10.10.5
Darwin xxxxxxxx.xxxxxx.xxxx.net 14.5.0 Darwin Kernel Version 14.5.0
    Tue Sep  1 21:23:09 PDT 2015
    root:xnu-2782.50.1~1/RELEASE_X86_64 x86_64
Comment 5 Naqeeb 2016-01-14 12:49:01 UTC
I have tried to reproduce this issue with following steps:
1. Open attached sample project given in comment 2  
2. Run the sample
3. click on Web View
4. Observed that BBC News appear
5. choose any news
6. Observed that it is open successfully
7. Use Back or Forward button(it is working fine) 
8. Go to menu page and choose Not a Web View
9. Again go to menu page and choose Web View  
10. Observed that a news will open which we choose in step 5
11. Click to Back button

Actual result: Observed that I am not navigate to back. Here is the screencast for the same: http://www.screencast.com/t/JsccnRdh6

But I am not sure I am reproduce correct or not. Let me know if I missed any steps.

I have checked this issue on both Xamarin.Forms 1.5.0.6447 and Xamarin.Forms 2.0.0.6490 and getting same behaviour.
Comment 6 Lewis Todd 2016-01-14 14:38:25 UTC
Hi there,
Thanks for investigating. Your screencast illustrates the issue on the latest version. 

Have you also changed the package reference to the older version of the nugget package for the WebViewTest Library that contains the views as well as the startup project? 

When i set the XForms package to 1.5.0.6447 on both assemblies i can get it working (this used to work in our live app).
Comment 7 Jason Smith [MSFT] 2016-04-13 19:27:09 UTC
This is caused by the fact that the renderers are not retained in this case. You need a method to retain this renderer so the native stack is also retained.
Comment 8 adrianknight89 2016-10-13 04:03:24 UTC
Is this something devs have to do on their own? I'd expect this kind of behavior to be default in XF.
Comment 9 adrianknight89 2016-10-13 17:45:50 UTC
At the same time, I'm somewhat reluctant to see a change in this behavior. In most cases, WebView should be shown modally as a single page. What's a real-world scenario where you want it to be a detail page? A long-running WebView should not be a replacement for a browser.

That said, I think there is a property somewhere in the source code that determines if native handlers should be disposed.