angular / angular/components

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

オープン
#14,833 コメント 60 件 リアクション 92 件 担当者 0 名 GitHub で見る
area: cdk/scrolling P3
主要言語
TypeScript
スター
25k
フォーク
6.8k
平均マージ
1日 8時間
マージ済み PR(30日)
91

説明

#### 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.

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

リンク先の StackBlitz で cdk-virtual-scroll-viewport を使用して動作を再現し、Angular ドキュメントの非仮想スクロールの例と比較します。最初の sticky ヘッダーを越えてスクロールすると、それらが消えることを確認します。仮想スクロール中、position: sticky を使用する要素が sticky パラメーターに従って表示され続ければ完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
angular, typescript
領域
frontend
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
38/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。