Ionic-framework: bug: Tapping the navbar to scroll to top is broken in 1.2.1

Created on 20 Dec 2015  路  6Comments  路  Source: ionic-team/ionic-framework

Type: bug

Platform: mobile webview

Hi there,

Great work by all at Drifty on Ionic -- I love it. After updating to 1.2.1 from 1.1, tapping the nav bar to scroll to top does not work anymore. Here's the requisite codepen demonstrating the bug. Scroll down a bit, tap the nav bar and on 1.1, it scrolls to top, but on 1.2.1 it doesn't.

Working on getting a new update to my app out and noticed this. Thanks again and happy holidays.

Luke

Most helpful comment

My resolution for browser platform: add a directive for class 'header-item'

angular
  .module('app')
  .directive('headerItem', ['$ionicScrollDelegate', function($ionicScrollDelegate) {
    var directive = {
      restrict: 'C',
      link: function(scope, element, attr) {
        element.bind('click', function() {
          $ionicScrollDelegate.scrollTop(true);
        });
      }
    };

    return directive;
  }]);

All 6 comments

@Ionitron :heart:

same problem here +1

The directive was commented out
https://github.com/driftyco/ionic/commit/cfa8042

Putting that line in fixes issue.

It looks like the intent was to allow native scrolling to kick-in, but still need to hookup the header 'tap' to scroll to top.

Hey, we removed that because it's non-standard and if you use the cordova-plugin-statusbar you'll get that for free, and it will actually work with the statusbar.

I'm open to adding it back, but I'm not sure we should be doing it. I need to be convinced :stuck_out_tongue:

Don't disagree, anyone can implement by providing on-tap themselves.
Would suggest updating the main doc page ion-header-bar and ion-nav-bar since the documented default is for this to happen. Guessing no-tap-scroll should just be removed?

My reasons for keeping are not strong enough

  • expected behavior in ionic apps (though not standard)
  • browser platforms do not have mobile equivalent

My resolution for browser platform: add a directive for class 'header-item'

angular
  .module('app')
  .directive('headerItem', ['$ionicScrollDelegate', function($ionicScrollDelegate) {
    var directive = {
      restrict: 'C',
      link: function(scope, element, attr) {
        element.bind('click', function() {
          $ionicScrollDelegate.scrollTop(true);
        });
      }
    };

    return directive;
  }]);
Was this page helpful?
0 / 5 - 0 ratings

Related issues

BilelKrichen picture BilelKrichen  路  3Comments

danbucholtz picture danbucholtz  路  3Comments

brandyscarney picture brandyscarney  路  3Comments

GeorgeAnanthSoosai picture GeorgeAnanthSoosai  路  3Comments

vswarte picture vswarte  路  3Comments