Skip to content

Commit

Permalink
fix(Scrolling): Don't trap scroll at 100% down
Browse files Browse the repository at this point in the history
My commit 382f0ae broke a fix from #2762. This change puts the fix back.

This should fix #1926
  • Loading branch information
c0bra committed Feb 16, 2015
1 parent 4381ca5 commit 78a4b43
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/js/core/directives/ui-grid-render-container.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,12 +150,12 @@

// todo: this isn't working when scrolling down. it works fine for up. tested on Chrome
// Let the parent container scroll if the grid is already at the top/bottom
if ((scrollEvent.y && scrollEvent.y.percentage !== 0 && scrollEvent.y.percentage !== 1 && containerCtrl.viewport[0].scrollTop !== 0 ) ||
if ((scrollEvent.y && scrollEvent.y.percentage !== 0 && scrollEvent.y.percentage !== 1) ||
(scrollEvent.x && scrollEvent.x.percentage !== 0 && scrollEvent.x.percentage !== 1)) {
event.preventDefault();
}

scrollEvent.fireThrottledScrollingEvent();
event.preventDefault();
scrollEvent.fireThrottledScrollingEvent();
}
});

$elm.bind('$destroy', function() {
Expand Down

8 comments on commit 78a4b43

@foxx9
Copy link
Contributor

@foxx9 foxx9 commented on 78a4b43 Feb 23, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you remove this part line 153 ?

&& containerCtrl.viewport[0].scrollTop !== 0

It introduces a new bug that prevents to scroll up when the mouse is on a grid : The prevent default action is triggered even if we are not at the top of the page.

@kmittal
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 to @foxx9

@foxx9
Copy link
Contributor

@foxx9 foxx9 commented on 78a4b43 Mar 3, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did a PR #2897

@c0bra
Copy link
Contributor Author

@c0bra c0bra commented on 78a4b43 Mar 4, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@foxx9 @kmittal Can you describe what exactly you're doing that is resulting in not being able to scroll up the page when the grid is scrolled to the top?

I can use the mousewheel to scroll up the page when the grid is scrolled to the top in Chrome, FF, and IE11.

@foxx9
Copy link
Contributor

@foxx9 foxx9 commented on 78a4b43 Mar 4, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can reproduce it right here : http://ui-grid.info/docs/#/tutorial/101_intro

On chrome for mac using the trackpad, if I put the mouse on the grid and try to scroll up, it doesn't work

@foxx9
Copy link
Contributor

@foxx9 foxx9 commented on 78a4b43 Mar 5, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@c0bra And I think the issue happens when the grid is inside a container which has a limited height, in my case I had an "overflow : scroll" on that container, so it was not about the global page scroll; maybe that's why you couldn't reproduce it in your test.

@PaulL1
Copy link
Contributor

@PaulL1 PaulL1 commented on 78a4b43 Mar 5, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It works when there are scrollable rows in the grid, but not when the grid has no scrollable rows (and so is both at the top and the bottom at the same time). I'm on a Mac so I'm not sure if this is specific trackpad behaviour or it would do it for all scroll wheels on that same tutorial.

@piyush-avantsoft
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still it does not allow me to scroll till bottom of grid,
2nd issue is when I do scrolling upwards/downwards other row seems blinking or looks like removed for while, its not giving smooth scroll.

Please sign in to comment.