Closed BppleMan closed 3 weeks ago
Please fork the stackblitz instead, add the code then post the final reproduction.
I'm having the same issue with cdk-virtual-scroll-viewport. I've forked the Stackblitz: https://stackblitz.com/edit/ngx-scrollbar-5gmgeb?file=src%2Fmain.ts
The issues are that the horizontal scroll is not visible and the vertical scroll is aligned to the right of the .cdk-virtual-scroll-spacer since the scrollbars are injected inside the cdk-virtual-scroll-spacer element. If we just use externalViewport=".cdk-virtual-scroll-viewport" externalContentWrapper=".cdk-virtual-scroll-content-wrapper" the scrollbars positions and visibility is correct but the size based on number of elements and position of the vertical scrollbar is incorrect.
@phantasma2983 Its weird, I have to check why its not automatically changing the spacer width!
Here is a quick workaround for now, use the following code:
ngAfterViewInit() {
setTimeout(() => {
const contentWrapper: HTMLElement = document.querySelector('.cdk-virtual-scroll-content-wrapper');
const spacer: HTMLElement = document.querySelector('.cdk-virtual-scroll-spacer');
spacer.style.width = `${contentWrapper.clientWidth}px`;
});
}
Reproduction
Use StackBlitz to reproduce your issue: https://stackblitz.com/edit/ngx-scrollbar
Steps to reproduce:
Expected Behavior
What behavior were you expecting to see?
Need to correctly handle the coexistence of horizontal and vertical scrolling for
cdk-virtual-scroll-viewport
Actual Behavior
What behavior did you actually see?
Environment