angular / angular/components

cdk-virtual-scroll-viewport does not handle css position: sticky cleanly

Đang mở
#14,833 60 bình luận 92 reaction 0 người được giao Xem trên GitHub
area: cdk/scrolling P3
Ngôn ngữ chính
TypeScript
Star
25k
Fork
6.8k
Merge trung bình
1 ngày 8 giờ
Pull request đã merge (30 ngày)
91

Mô tả

#### What is the expected behavior?
using the css attribute `position: sticky` should allow for elements to remain displayed according to their sticky parameters.

#### What is the current behavior?
This works for a while but then breaks after a point. Im assuming its a matter of the 'stickied' dom elements getting recycled.

#### What are the steps to reproduce?
https://stackblitz.com/edit/angular-wnar6b-wzjdmh

This is a slightly modified version of an example from the docs. As you scroll the cdk-virtual-scroll-viewport you will notice the light blue headers stick to the the top of their area as expected. Once you exceed a certain amount of scrolling however the headers disappear. For me items 0-2 work but the 3rd one breaks.

Down below is an example using the [non-virtual] scrolling. Here the css attribute works as expected.

#### Which versions of Angular, Material, OS, TypeScript, browsers are affected?
Forked from https://stackblitz.com/angular/apvvljrovad from the docs. no versions changed.

#### Is there anything else we should know?
https://github.com/angular/material2/issues/11621 also gets at my base requirement; wanting some elements of the virtual scroll list to 'stick around'. It would be ideal if standard css properties worked as via this ticket but that might be hard as the whole point of virtual-scroll is to remove things from the dom that 'shouldn't' be rendered. The position: sticky css attribute would seem to break those assumptions.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Hướng nghiên cứu

Tái hiện hành vi trong StackBlitz được liên kết bằng cách sử dụng cdk-virtual-scroll-viewport, sau đó so sánh với ví dụ cuộn không ảo trong tài liệu Angular. Xác minh cách việc cuộn qua các sticky header đầu tiên khiến chúng biến mất. Được xem là hoàn tất khi các phần tử sử dụng position: sticky vẫn được hiển thị theo các tham số sticky của chúng trong suốt quá trình cuộn ảo.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
angular, typescript
Lĩnh vực
frontend
Loại issue
Lỗi
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
38/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.