Skip to content

RC.0 - ion-back-button with child in tabs starter goes to wrong tab  #16923

Closed

Description

@kensodemann

Bug Report

Ionic version:

[x] 4.x

Current behavior:

Using ion-back-button from a tab other than first tab takes you to first tab, not tab that launched the child.

Expected behavior:

The ion-back-button should take you back to the tab from whence you came.

Steps to reproduce:

  1. use tab starter
  2. add a child page with default ion-back-button config in toolbar
  3. go to child from tab two or three
  4. hit back button
  5. end up on tab one...

Related code:

https://github.com/kensodemann/issue-tabs-back-button-

  1. clone
  2. npm start
  3. go to tab 2
  4. hit the "have a baby" button
  5. child open
  6. hit back button on child
  7. you are now on tab one instead of two

Ionic info:

~/Projects/Issues/issue-tabs-back-button (master): ionic info

Ionic:

   ionic (Ionic CLI)             : 4.6.0 (/usr/lib/node_modules/ionic)
   Ionic Framework               : @ionic/angular 4.0.0-rc.0
   @angular-devkit/build-angular : 0.11.4
   @angular-devkit/schematics    : 7.1.4
   @angular/cli                  : 7.1.4
   @ionic/angular-toolkit        : 1.2.2

System:

   NodeJS : v10.14.2 (/home/kensodemann/.nvm/versions/node/v10.14.2/bin/node)
   npm    : 6.4.1
   OS     : Linux 4.15

Activity

  1. supperdsj commented on Jan 4, 2019

    @supperdsj

    <ion-back-button (click)="navCtrl.goBack()"></ion-back-button>
    NavController.goBack() can go back to the right page.

  2. kensodemann commented on Jan 4, 2019

    @kensodemann
    ContributorAuthor

    I was using a slightly more "hard coded" workaround for now, but I like that one better. Thanks @supperdsj!

  3. RHinderiks commented on Jan 9, 2019

    @RHinderiks

    @supperdsj This still causes issues with our app, as far as i know setting a click on a back button does not prevent it from executing its normal behaviour, so in this case your triggering your own goBack and the default behaviour of the back button ?

  4. supperdsj commented on Jan 10, 2019

    @supperdsj

    @kensodemann hope you share more detail about your "hard coded" solution :)

  5. hiepxanh commented on Jan 11, 2019

    @hiepxanh
    Contributor

    navCtrl.goBack() that function causing my tab view being destroyed

  6. supperdsj commented on Jan 14, 2019

    @supperdsj

    <ion-button color="primary" fill="clear" (click)="navCtrl.goBack();"> <ion-icon slot="start" name="arrow-back"></ion-icon>back </ion-button>
    work for me

  7. paulstelzer commented on Jan 15, 2019

    @paulstelzer
    Contributor

    I close this as duplicate of #15216

    I think my gif demonstrate the issue well -> #15216 (comment) (after navigating back it opens the first tab)

    and I think it's the same issue like described here

  8. kensodemann commented on Jan 15, 2019

    @kensodemann
    ContributorAuthor

    You are correct sir!! (locking this as well to avoid further discussion here)

  9. locked and limited conversation to collaborators on Jan 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    package: angular

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions