Skip to content

bug: tabs select method is not selecting the correct tab on load #17957

Closed

Description

@brandyscarney

Bug Report

Ionic version:

[x] 4.x

Current behavior:
Using the ion-tabs select method on load will alternate between selecting the first tab and the one specified.

Expected behavior:
It should select the proper tab every time.

Steps to reproduce:
The following Codepen will reproduce this: https://codepen.io/brandyscarney/pen/WmgoyP?editors=1011

If you comment/uncomment the following line it will force a reload and you'll see the selected tab changes between tab one and tab three:

  // console.log('comment this out to force a reload');

Related code:

I believe the source of the problem is the init:

https://github.com/ionic-team/ionic/blob/master/core/src/components/tabs/tabs.tsx#L155

The solution may be to do an await this.initSelect(); in componentDidLoad():

https://github.com/ionic-team/ionic/blob/master/core/src/components/tabs/tabs.tsx#L57

Activity

  1. added
    package: core
    type: bug
    and removed on Apr 4, 2019
  2. brandyscarney commented on May 20, 2019

    @brandyscarney
    MemberAuthor

    Fixed by da38647

  3. added a commit that references this issue on May 22, 2019
  4. ionitron-bot commented on Jun 19, 2019

    @ionitron-bot

    Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.

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

Metadata

Metadata

Assignees

Labels

package: coretype: bug

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