ionic-framework icon indicating copy to clipboard operation
ionic-framework copied to clipboard

bug: angular ion-back-button pushes new entry to stack instead of popping

Open StefanNedelchev opened this issue 4 years ago • 15 comments

Bug Report

Ionic version: 5.6.9

Platform Web

Imagine that you have the following stack in the history: [A, B]. You are currently on page B and press a <ion-back-button> element.

Current behavior: The back button correctly navigates to the previous page A but does it by adding a new entry (let's call it C), leaving us with the following stack: [A, B, C]. In this case C and A are the same routes. As a result, using the native back button (or browser back button) afterwards returns the user back to page B while naturally you would not expect it. This seriously breaks the experience when the app is installed as a PWA resulting in large history stacks with repeating routes. Android users might have hard time closing the app if they rely on the native back button

Expected behavior: The back button should navigate to page A while removing B from the stack, making it impossible for the user to return back to B using native navigation.

Steps to reproduce:

  1. Generate a fresh Ionic Angular project with the CLI.
  2. Create additional page if necessary and put <ion-back-button> in its toolbar.
  3. Add a button on the main page which navigates to the 2nd page using the default ionic strategy.
  4. After being navigated to the 2nd page, press the ion-back-button.
  5. After being returned back to the main page, press the browser's back button (or the native back button if you are on Android).
  6. The issue should be reproduced now

Other information: This issue is not new, I've been experiencing it since I started using Ionic a couple of months ago. Also i don't know if the issue exists on native Android/iOS apps because my project is just a PWA.

StefanNedelchev avatar Jun 12 '21 07:06 StefanNedelchev

Any updated on this case?

StefanNedelchev avatar Aug 14 '21 21:08 StefanNedelchev

Sorry for the bump but do you plan fixing this for v6 of Ionic?

StefanNedelchev avatar Nov 21 '21 12:11 StefanNedelchev

Any news on this ? It affects our app.

TomDemulierChevret avatar Jan 07 '22 08:01 TomDemulierChevret

Any news on this ? It affects our app.

doesn't seem to be fixed even in Ionic 6

StefanNedelchev avatar Jan 07 '22 18:01 StefanNedelchev

@hardmaster92 Thanks for the feedback.

TomDemulierChevret avatar Jan 10 '22 08:01 TomDemulierChevret

Any news on this issue besides the fact it's been tracked internally for 15 months?

StefanNedelchev avatar Sep 07 '22 19:09 StefanNedelchev

Still happening, any help or workaround would be appreciated.

RRGT19 avatar Oct 22 '22 11:10 RRGT19

That' really killing bug which makes the ion-back-button totally useless

dderakhshani avatar Dec 11 '22 09:12 dderakhshani

This bug is very annoying. It messes the whole navigation stack. I think previous use for nav controllers was much better than angular routing.

asaxena48 avatar Mar 02 '23 03:03 asaxena48

+1

ppmarco avatar Aug 25 '23 16:08 ppmarco

Sorry for the bump. Almost 3 years have passed since the bug was reported and I'm curious to learn if there is any progress on it. This is a critical issue for PWAs and I'm surprised that it's not prioritised

StefanNedelchev avatar Jan 23 '24 07:01 StefanNedelchev