Hosted App Native Back Button fires "popstate" event when not hooked up

Fixed Issue #12064022


Leo W.
May 18, 2017
This issue is public.
Fixed in build #
Reported by 1 person

Sign in to watch or report this issue.

Steps to reproduce

When running as a Hosted Web App, the native back button (task bar back arrow in tablet, back arrow in title bar) automatically acts like a browser back button and triggers a popstate event.

This behavior happens without explicitly registering a “backrequested” event listener to SystemNavigationManager.

  1. Launch Application from Start Menu
  2. Hit back button (either from task bar or title bar)
    Expected Result: No action
    Actual Result: popstate event triggered.

Testing Environment: 1607 (14393)

This is contrary to all documentation describing the default back button behavior - which is no action. This behavior is also inconsistent with Web Context app and Local App.

What gets interesting and even more inconsistent is that if the app is triggered again when it is active (in the case of a deep link from pinned content), the correct behavior resumes (ie. no back button action):

  1. Launch Application from Start Menu
  2. Launch Application again from Start Menu without closing
  3. Hit back button
    Expected/Actual result: No action

The back button also automatically disappears once the history stack is empty despite setting AppViewBackButtonVisibility to visible.

To reproduce, simply create a new Hosted Web App with the following js:

window.onload = function() {
// Add some items to the history stack
history.pushState({isDummy: true}, "dummyState", null);
history.pushState({isDummy: true}, "dummyState", null);

// Bug#1: Register to popstate - note that backrequested is not registered anywhere
window.addEventListener("popstate", function(){showAlert(“popstate triggered”)});

// Always show back button -
// Bug #2: button will disappear once history stack empties
var sNM = Windows.UI.Core.SystemNavigationManager.getForCurrentView();
sNM.appViewBackButtonVisibility = Windows.UI.Core.AppViewBackButtonVisibility.visible;

function showAlert(msg){
var msgDialog = new Windows.UI.Popups.MessageDialog(msg, “Alert”);


2 attachments

Comments and activity

  • Changed Steps to Reproduce

    Changed Steps to Reproduce

  • Microsoft Edge Team

    Changed Assigned To to “Steven K.”

    Changed Assigned To to “wwatri”

    Changed Assigned To from “wwatri” to “Jameson L.”

    Changed Status to “Confirmed”

    Changed Status from “Confirmed” to “Fixed”

You need to sign in to your Microsoft account to add a comment.

Sign in