# Tab Icon Jumps

**URL:** <https://forum.ionicframework.com/t/tab-icon-jumps/34316>\
**Category:** ionic-v1\
**Created:** [October 10, 2015, 1:01pm UTC](https://forum.ionicframework.com/t/tab-icon-jumps/34316 "2015-10-10T13:01:44Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![hipbit](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/hipbit/32/90470_2.png) [@hipbit](https://forum.ionicframework.com/u/hipbit)\
**Post date:** [October 10, 2015, 1:01pm UTC](https://forum.ionicframework.com/t/tab-icon-jumps/34316/1 "2015-10-10T13:01:44Z")

</div>

I’ve got a problem that is driving me crazy. I’m using a tab bar (icons only) and in the simulator or while running on the device with iOS my tab icons (ionicons) are jumping when switching between tabs. It looks like for a split second there’s the current icon with the same icon a few pixel below it (you can just see the top 1/5th of the icon below it for a split second).

Strangely, I have four tabs and only the first two do that, and only if they are the tabs being switched to/from.

---

<div class="post-metadata">

**Author:** ![DutchKev](https://avatars.discourse-cdn.com/v4/letter/d/f14d63/32.png) [@DutchKev](https://forum.ionicframework.com/u/DutchKev)\
**Post date:** [October 10, 2015, 4:57pm UTC](https://forum.ionicframework.com/t/tab-icon-jumps/34316/2 "2015-10-10T16:57:48Z")

</div>

Have you edited something in the CSS?

I was playing with the CSS a while ago, and encountered the same problem as you… If so, you could try disabling all custom css and see if it still happens

---

<div class="post-metadata">

**Author:** ![hipbit](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/hipbit/32/90470_2.png) [@hipbit](https://forum.ionicframework.com/u/hipbit)\
**Post date:** [October 14, 2015, 7:10pm UTC](https://forum.ionicframework.com/t/tab-icon-jumps/34316/3 "2015-10-14T19:10:12Z")

</div>

I’ve removed any custom CSS and I still have the same problem. As a matter of fact, I just tried using ‘ionic start testApp tabs’ and sent it straight to Ionic View with the same problem.

---

<div class="post-metadata">

**Author:** ![david43](https://avatars.discourse-cdn.com/v4/letter/d/b77776/32.png) [@david43](https://forum.ionicframework.com/u/david43)\
**Post date:** [October 16, 2015, 1:47am UTC](https://forum.ionicframework.com/t/tab-icon-jumps/34316/4 "2015-10-16T01:47:08Z")

</div>

hi, i got save problem on ios.  
i also download ‘ionic start myapp tabs’ to test  
but when i click the bar icon  
it will jump to btm then jump back

---

<div class="post-metadata">

**Author:** ![buunguyen](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/buunguyen/32/83024_2.png) [@buunguyen](https://forum.ionicframework.com/u/buunguyen)\
**Post date:** [October 16, 2015, 10:50pm UTC](https://forum.ionicframework.com/t/tab-icon-jumps/34316/5 "2015-10-16T22:50:07Z")

</div>

I’m seeing the same behavior, icons just jumping. In my case, all tab icons jump, including those in the bottom and top, even those not linking to new route. I tried to remove all app CSS, only retained Ionic CSS but the issue still appears. Very strange.

---

<div class="post-metadata">

**Author:** ![buunguyen](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/buunguyen/32/83024_2.png) [@buunguyen](https://forum.ionicframework.com/u/buunguyen)\
**Post date:** [October 16, 2015, 10:59pm UTC](https://forum.ionicframework.com/t/tab-icon-jumps/34316/6 "2015-10-16T22:59:24Z")

</div>

I recorded the issue in this clip: [http://jmp.sh/0A5ql5d](http://jmp.sh/0A5ql5d)

---

<div class="post-metadata">

**Author:** ![hipbit](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/hipbit/32/90470_2.png) [@hipbit](https://forum.ionicframework.com/u/hipbit)\
**Post date:** [October 16, 2015, 11:10pm UTC](https://forum.ionicframework.com/t/tab-icon-jumps/34316/7 "2015-10-16T23:10:41Z")

</div>

Yep, that’s exactly what I’m seeing!

---

<div class="post-metadata">

**Author:** ![david43](https://avatars.discourse-cdn.com/v4/letter/d/b77776/32.png) [@david43](https://forum.ionicframework.com/u/david43)\
**Post date:** [October 17, 2015, 4:07am UTC](https://forum.ionicframework.com/t/tab-icon-jumps/34316/8 "2015-10-17T04:07:58Z")

</div>

me too,  
any solution?

---

<div class="post-metadata">

**Author:** ![david43](https://avatars.discourse-cdn.com/v4/letter/d/b77776/32.png) [@david43](https://forum.ionicframework.com/u/david43)\
**Post date:** [October 17, 2015, 6:17am UTC](https://forum.ionicframework.com/t/tab-icon-jumps/34316/9 "2015-10-17T06:17:32Z")

</div>

hi,  
i think ionic will remove tab icon and then add it again  
so maybe some mobile not fast enough to display.  
then we see the icon jump.

my noob solution:  
edit lib/ionic/js/ionic.bundle.js go to line around 58901  
replace template

```
template:
'<a ng-class="{\'tab-item-active\': isTabActive(), \'has-badge\':badge, \'tab-hidden\':isHidden()}" ' +
  ' ng-disabled="disabled()" class="tab-item">' +
  '<span class="badge {{badgeStyle}}" ng-if="badge">{{badge}}</span>' +
  '<i class="icon {{getIconOn()}}" ></i>' +
  '<span class="tab-title" ng-bind-html="title"></span>' +
'</a>',
```

---

<div class="post-metadata">

**Author:** ![hipbit](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/hipbit/32/90470_2.png) [@hipbit](https://forum.ionicframework.com/u/hipbit)\
**Post date:** [October 17, 2015, 12:36pm UTC](https://forum.ionicframework.com/t/tab-icon-jumps/34316/10 "2015-10-17T12:36:30Z")

</div>

I’m not using different icons for the on and off states, so this works for me for the time being!

I’ve noticed the same issue using both a Nexus 6 and an iPhone 6s+, so I can’t believe it’s due to the devices not having enough processing power to swap out the icons without the jumping.

Maybe it’s always been there and I’ve just never noticed it before.

---

<div class="post-metadata">

**Author:** ![buunguyen](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/buunguyen/32/83024_2.png) [@buunguyen](https://forum.ionicframework.com/u/buunguyen)\
**Post date:** [October 17, 2015, 10:42pm UTC](https://forum.ionicframework.com/t/tab-icon-jumps/34316/11 "2015-10-17T22:42:52Z")

</div>

Yeah, the problem is with ng-if to show/hide icon. I’ve changed to ng-show but the issue remains. Funny thing is there are many places using ng-if and ng-show without the problem. I looked for transition delay, which is usually the source of such problems in AngularJS but couldn’t find any use of such.

Anyway, if you use the same icon for both states and don’t want to modify ionic source, just include this patch somewhere in your code. (If you don’t use ES2015, just replace the templated string and `const` declaration.)

```
angular
  .module('ionic')
  .config(['$provide', function ($provide) {
    $provide.decorator('ionTabNavDirective', ['$delegate', function ($delegate) {
      const directive = $delegate[0]

      directive.template = 
        `<a ng-class="{'tab-item-active': isTabActive(), 'has-badge':badge, 'tab-hidden':isHidden()}"
            ng-disabled="disabled()" class="tab-item">
          <span class="badge {{badgeStyle}}" ng-if="badge">{{badge}}</span>
          <i class="icon {{getIconOn()}}"></i>
          <span class="tab-title" ng-bind-html="title"></span>
        </a>`

      return $delegate
    }])
  }])
```

---

<div class="post-metadata">

**Author:** ![sa7booch](https://avatars.discourse-cdn.com/v4/letter/s/85f322/32.png) [@sa7booch](https://forum.ionicframework.com/u/sa7booch)\
**Post date:** [February 29, 2016, 4:16pm UTC](https://forum.ionicframework.com/t/tab-icon-jumps/34316/12 "2016-02-29T16:16:21Z")

</div>

Thank you buunguyen for this solution 🙂

i just make some changes :

`angular.module('ionic').config(['$provide', function ($provide) { $provide.decorator('ionTabNavDirective', ['$delegate', function ($delegate) { const directive = $delegate[0]; directive.template = '<a ng-class="{\'tab-item-active\': isTabActive(), \'has-badge\':badge, \'tab-hidden\':isHidden()}" ' + ' ng-disabled="disabled()" class="tab-item">' + '<span class="badge {{badgeStyle}}" ng-if="badge">{{badge}}</span>' + '<i class="icon" ng-class="{true: getIconOn(), false: getIconOff()}[isTabActive()]"></i>' + '<span class="tab-title" ng-bind-html="title"></span>' + '</a>'; return $delegate; } ]) } ]);`
