You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Scroll events not getting fired when content inside md-content is scrolled #802
When the content placed inside is larger than the available height, the scroll events are not firing. This is preventing me from implementing infinite scroll on various components.
Can you please let me know if there is a workaround for this?
overflow: auto; doesn't look good, so it's not an option.
An alternative solution is to not use fullscreen on md-sidenav-layout. Some CSS tweaks help, although, if I set body { height:100%; } it also breaks document:scroll event listener.
I confirm it, without fullscreen it's works. So if you want have scroll content insiede sidenav you could use scroll event on div content. For example:
<md-sidenav-containerfullscreen><md-sidenavalign="start" #drleft></md-sidenav><divlayout="column" layout-fill><divflexlayout="column" class="content md-content" (scroll)="onScroll($event)">
put here your scrollable data
</div></div></md-sidenav-container>
@mmalerba would it be possible to expose the Scrollable instance? That would give user's the ability to subscribe to elementScrolled() instead of having to use document.querySelector()
@willshowell Thanks again! The solution though working, but not very pretty as for me. It's bad that the ability to handle scroll events by the native Angular way is lost
@willshowell I'm currently looking into how to make the sidenav work better for mobile use cases (where people typically want a fixed position sidenav and the scroll events get fired on the body, so that the browser chrome will scroll out of view). I'll think about this too while I'm prototyping. What if we just give developers control of the content element? That seems like the easiest solution to this issue. For example:
It seems to me that there is some shortcoming in sidenav architecture. I do not understand why the side navigation should wrap a content and override properties and behavior of main container. IMO sidenav should be in the container next to other content, rather than around it. For exemple md-toolbar doesn't wrap main content. Because of this, there are problems with scrolling and positioning of elements.
Activity
mrusful commentedon Jul 9, 2016
Looks like #703 change behavior.
scrollevent fires bymd-content.As a workaround, i think, you can wrap all what not in
md-sidenavintodivand listenscrollevent on it.karser commentedon Apr 10, 2017
overflow: auto;doesn't look good, so it's not an option.An alternative solution is to not use fullscreen on
md-sidenav-layout. Some CSS tweaks help, although, if I setbody { height:100%; }it also breaksdocument:scrollevent listener.matte00 commentedon Jun 1, 2017
I confirm it, without fullscreen it's works. So if you want have scroll content insiede sidenav you could use scroll event on div content. For example:
twoheaded commentedon Jul 17, 2017
Looks like something wrong with it. I have no idea how to handle scroll event in my app with md-sidenav.
Plunker
willshowell commentedon Jul 17, 2017
@twoheaded Here's one way to do it https://plnkr.co/edit/BjOKFrP5mNOdVI8d2EKl?p=preview
@mmalerba would it be possible to expose the
Scrollableinstance? That would give user's the ability to subscribe toelementScrolled()instead of having to usedocument.querySelector()twoheaded commentedon Jul 17, 2017
@willshowell Thanks again! The solution though working, but not very pretty as for me. It's bad that the ability to handle scroll events by the native Angular way is lost
mmalerba commentedon Jul 17, 2017
@willshowell I'm currently looking into how to make the sidenav work better for mobile use cases (where people typically want a fixed position sidenav and the scroll events get fired on the body, so that the browser chrome will scroll out of view). I'll think about this too while I'm prototyping. What if we just give developers control of the content element? That seems like the easiest solution to this issue. For example:
willshowell commentedon Jul 17, 2017
@mmalerba IMO that sounds more versatile and I like that it's a little more prescriptive
twoheaded commentedon Jul 18, 2017
It seems to me that there is some shortcoming in sidenav architecture. I do not understand why the side navigation should wrap a content and override properties and behavior of main container. IMO sidenav should be in the container next to other content, rather than around it. For exemple md-toolbar doesn't wrap main content. Because of this, there are problems with scrolling and positioning of elements.
Fix scrolling for now.
jelbourn commentedon Sep 26, 2017
@mmalerba can we close this now that fixed sidenav is in master?
mmalerba commentedon Oct 13, 2017
yep, fixed sidenav is in now, and docs are coming in #7775
angular-automatic-lock-bot commentedon Sep 8, 2019
This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.