md-select interferes with the window scroll listener
I created a jsFiddle. I have a sticky nav on scroll. If you click the select dropdown at the bottom of the page, since it removes the scroll bar, it messes (hides) the navigation bar at the top.
On a quick glance, it looks like the md-virtual-scroll-container with md-virtual-scroller is wrapping the entire content inside <body>, hence hiding the scrollbar. I thought wrapping the md-select with md-content might help but it didn't make any difference.
Any thoughts?
Same problem here, also, updating dom path seems dangerous, it can break css rules and other js behaviors. Why is this necessary ?
+1
I think I found the problem in the code. In util.js, I am not sure the need for checking $document[0].body.scrollTop || $document[0].documentElement.scrollTop. Just checking if the lastParent is defined or not should suffice. Something like
if (!disableTarget) {
if (!lastParent) {
disableTarget = angular.element($document[0].body);
} else {
disableTarget = angular.element(lastParent);
}
}
I did a quick test in Chrome/FF/IE - it seems to be working.
@PrashantAshok can you check the latest source from master and see if your issue still persists? It does still break your jsfiddle, but I imagine that if we added a md-scroll-disabled class to the body element you could probably style your sticky header appropriately. Here is a link to your updated fiddle. Let me know your thoughts.
@rschmukler - thanks. Looks great now, that the body is not being wrapped. But the issue still persists.
there is a minor issue, in util.js, shouldn't the check be >= rather than just >? Or am I missing something?
I had to make that change along with wrapping the md-select with md-content, Updated jsFiddle. Then works perfectly.
An element's scrollHeight is always equal to its offsetHeight unless it is scrolling, in which case it is greater than it. So, in the case of isScrolling() we want to return true only if >.
The reason that your fiddle works with it that way is because it's not actually disabling the scrolling :) You can see that it's possible to scroll.
Make sense. Oh, sorry didn't notice that. What's md-scroll-disabled class?
But if we try to remove scroll (bar), it would mess up the scroll listeners/offset calculations. Or did you have something other in mind?
(Apologies for a bit complicated fiddle, a simpler fiddle is here - Scroll down a bit and then click select).