-
-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] overflow-y stop working when switching pages #218
Comments
@luckashenri not checked yet, just quick assumption that router remove elements from DOM. Maybe just init inside body will fix. I will check in few days. |
@roman-rr I tried with diff version, but still no luck. Something interesting is that after calling 'scrollElementInit' it does work to scroll down, but when I scroll up it brings the panel together. Well keep trying at the meantime and keep u posted. |
@luckashenri Thank you again, I've checked. In your case, you just want to scroll up on each new page? |
@roman-rr I found out something interesting.. Not sure if u're familiar with angular, or any other framework like that.. But basically when I put the 'overflow-y' attribute in a upper level, it will render the inner data correctly with scroll. When I do it inside each inner page, it will work for first one only, and then break. In this example, the pages have their own custom header, and custom body. In that case, the scroll breaks cause it needs to recalc everytime I switch page (that's what I think). example 2: In this second example, I have the page changing INSIDE the overflow-y div.. In that case, even changing the height of inner content, it works nicely.. |
@luckashenri Would you like to recalculate height of
If nothing works, your example still relevant ? I may try to do this right on this example ? Or you have to adjust this example with headers ? |
I don't want the overflow-y to recalc it necessarely, it's just that I noticed that it loses the height once I move to another page for some reason, I thought recalculating would fix, but it caused the scroll affecting the drawer as well. (like I explain below answering ur second question). 1 - Yes, it didn't have any effect. Yeah that project I sent is still valid. In fact now I added 2 modules. One with it working (but with static header). And another with dynamic header (that comes within the page) but with scroll breaking. Seems like stackblitz doesn't want to run it lol.. I guess u'll need to clone and run it. Lemme know if it works for u. |
@roman-rr not sure it's relavant, but I noticed it shows 'cancelable: true' once it's being dragged.. The only difference I noticed so far between them. working example (I took this screenshot before switching pages, so I could check how was the states before breaking): |
@luckashenri thank you for details, I'll check in couple days |
@luckashenri Thank you for interesting case! SolutionChange your function to: ngAfterViewInit() {
this.router.events.pipe(
filter(event => event instanceof NavigationEnd)
).subscribe({
next: async (value) => {
await new Promise(resolve => requestAnimationFrame(resolve));
this.myPane.scrollElementInit();
this.myPane.checkOverflowAttr(this.myPane.breakpoints.currentBreakpoint);
this.myPane.events.detachAllEvents();
this.myPane.events.attachAllEvents();
},
});
} Not a simple case, if there are more such re-renders for overflow-y element in the future, I will make some scoped functions to manage events re-attachments around the scroll element. |
@roman-rr Yeah just got a chance to test it, it worked!! |
Describe the bug
Currently in my angular app, I added some routing inside the Drawer. Aka Cupertino Pane.
Everytime I move to another route the overflow-y stop working, like there's no scrolling.
At first I thought about recalculating and I found out that there's this method called 'calcFitHeight', but when I call it it says 'calcFitHeight is not a function'.
Second try was calling 'scrollElementInit'. That worked but only if I scroll DOWN. When I try to scroll UP again it brings the whole drawer with it.
https://github.com/luckashenri/cupertino-pane-bug
To Reproduce
Steps to reproduce the behavior:
Expected behavior
When I switch page, it should recalculate and present the scroll like it does the first time I refresh. Or at least allow me to access some recalculate method.
Screenshots
Desktop:
Additional context
Angular 16.2
No other library installed.
If I don't use overflow-y it works normally.
The text was updated successfully, but these errors were encountered: