question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Scroll events not getting fired when content inside md-content is scrolled

See original GitHub issue

Bug, feature request, or proposal:

Bug

What is the expected behavior?

When you scroll the page and the md-content’s height is larger than the available space, page scroll events should be fired.

What is the current behavior?

They don’t get fired.

Please note, this was working correctly in the alpha5 version but now it’s broken in v2.0.0.-alpha6.

To add further information, consider this to be the layout:

<md-sidenav-layout>
    <md-sidenav #sidenav>
        <md-nav-list>
            ...
    </md-sidenav>
    <md-toolbar style="background-color: #2db1eb; color: white">
            ...
    </md-toolbar>
    <router-outlet></router-outlet>
</md-sidenav-layout>

When the content placed inside <router-outlet> 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?

Many thanks,

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:2
  • Comments:13 (5 by maintainers)

github_iconTop GitHub Comments

3reactions
mrusfulcommented, Jul 9, 2016

Looks like #703 change behavior. scroll event fires by md-content.

As a workaround, i think, you can wrap all what not in md-sidenav into div and listen scroll event on it.

<div (scroll)="handleScroll($event.target)" style="height: 100%; overflow: auto;">
    <md-toolbar style="background-color: #2db1eb; color: white">
        ...
    </md-toolbar>
    <router-outlet></router-outlet>
</div>
2reactions
twoheadedcommented, 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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why could window scroll event not being fired - Stack Overflow
It could be that some element (the body itself or some nested div ) has the css overflow property set to scroll ....
Read more >
JavaScript Scroll Events, Event Throttling & Passive Events
When you scroll a document or an element, the scroll events fire. You can trigger the scroll events in the following ways, for...
Read more >
Document: scroll event - Web APIs - MDN Web Docs - Mozilla
The scroll event fires when the document view has been scrolled. To detect when scrolling has completed, see the Document: scrollend event.
Read more >
.scroll() | jQuery API Documentation
The scroll event is sent to an element when the user scrolls to a different place in the element. It applies to window...
Read more >
Scroll Events and Intersection Observer - Beginner JavaScript
The way to do it now is called Intersection Observer. Rather than figuring out how far along the page the user has scrolled,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found