-
Notifications
You must be signed in to change notification settings - Fork 13.5k
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: ion-header fade/condense usage is incorrect with Angular CDK Virtual Scroll #25463
Comments
@mtnair thanks for reporting this issue! If you relocate the
I need to revisit the implementation. The test case has |
Thank you, with the |
Apologies for the delay. I have been able to diagnose this issue further and believe the current usage in the docs is correct, but the current implementation pattern is incorrect. The When originally implementing this, I did not account for the intersection observer that is used for the fade and collapsible effect. I will need to translate the header out-of-view when using a virtual scroll container. Also, some of the queries for DOM elements will need to be adjusted to query from I have a work-in-progress branch that I will create a dev build from, once I verify the condense and fade effects are consistent with non-virtual scroll usage. |
Here is a dev-build to test with: npm install @ionic/[email protected] One thing to note, when using a virtual scroll container with the fade/condense effect, the dev build will now translate the header off the view. Since the scroll element is disabled for the To have the same design as when used without virtual scrolling, wrap the content in a container with e.g.: #container {
height: 100%;
overflow: hidden;
} <ion-header></ion-header>
<ion-content [scrollY]="false">
<div id="container">
<ion-header></ion-header>
<cdk-virtual-scroll class="ion-content-scroll-host"></cdk-virtual-scroll>
</div>
</ion-content> Without this, the header that is scrolled off the view will show blurred under the condensed header. |
Hello after looking at this issue fresh and comparing against the proposed changes, I have decided to close this out. The I think we can improve the documentation around this, by showing usage for condense in the docs as well. I have created: ionic-team/ionic-docs#2663 to track this. |
Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out. |
Prerequisites
Ionic Framework Version
Current Behavior
When using the
<ion-header>
component in combination with Angular's<cdk-virtual-scroll-viewport>
component, to fade/condense the header when scrolling in the list, it does not work. I also added theion-content-scroll-host
class to the<cdk-virtual-scroll-viewport>
component to no avail.I created a demo with the header effect inspired by the workaround proposed in the feature request #25157:
https://stackblitz.com/edit/ionic6-angular13-rsezrm?file=src%2Fapp%2Fapp.component.ts
If you set
virtualScroll
in the app.component.ts to "false", you can see the expected behavior without a virtual scroll.Another problem in the current behavior: When setting the height of the
<cdk-virtual-scroll-viewport>
element to 100%, the space used by the<ion-header>
inside<ion-content>
causes to overflow the virtual scroll component, so the last element in the list is invisible.Expected Behavior
When using the
<ion-header>
component in combination with Angular's<cdk-virtual-scroll-viewport>
component, the header should fade and condense like it's described in the official documentation: https://ionicframework.com/docs/api/header#usage-with-virtual-scrollSteps to Reproduce
virtualScroll
inapp.component.ts
to "false"<ion-list>
without the virtual scrollCode Reproduction URL
https://github.com/mtnair/ionic6-virtual-scroll-header-repro
Ionic Info
$ ionic info
Ionic:
Ionic CLI : 6.18.2 (C:\Users[...]\AppData\Roaming\npm\node_modules@ionic\cli)
Ionic Framework : @ionic/angular 6.1.9
@angular-devkit/build-angular : 13.3.7
@angular-devkit/schematics : 13.3.7
@angular/cli : 13.3.7
@ionic/angular-toolkit : 6.1.0
Utility:
cordova-res : 0.15.4
native-run : 1.5.0
System:
NodeJS : v14.17.5 (C:\Program Files\nodejs\node.exe)
npm : 8.10.0
OS : Windows 10
Additional Information
I followed the docs on the implementation of the virtual scrolling.
A related issue that I came across: #25318
The text was updated successfully, but these errors were encountered: