ionic-framework: Tabs: previousTab() method returns wrong Tab component
Ionic version: [ ] 1.x [x] 2.x
I’m submitting a … [x] bug report [ ] feature request [ ] support request
Current behavior:
The previousTab()
method from the Tabs
component returns the incorrect Tab when called. Currently, it returns the tab that came before the correct one, or null.
Expected behavior: It should always return the most recent Tab component in the selection history that meets the relevant criteria (not hidden, not disabled).
Steps to reproduce:
- Clone this repo: https://github.com/jsayol/ionic-issue-9999.git
- Change tabs and watch the information logged out to the console
Related code:
The problem seems to be when looping over _selectHistory
:
for (var i = this._selectHistory.length - 2; i >= 0; i--) {
should be:
for (var i = this._selectHistory.length - 1; i >= 0; i--) {
Other information: I’m preparing a PR, I want to make sure to update the tests to catch this.
Ionic info:
Your system information:
Cordova CLI: 6.4.0
Ionic Framework Version: 2.0.0-rc.5
Ionic CLI Version: 2.1.18
Ionic App Lib Version: 2.1.7
Ionic App Scripts Version: 1.0.0
ios-deploy version: Not installed
ios-sim version: Not installed
OS: Linux 4.8
Node Version: v7.4.0
Xcode version: Not installed
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 1
- Comments: 15 (13 by maintainers)
Merged and fixed! Thanks everyone!