bug(virtual-scroll): scrollToIndex on viewport while inside cdkVirtualScrollingElement is wrong
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 64/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 静か
- 技術スタック
- angular, typescript
- 領域
- frontend
調査の方向性
まず CDK の仮想スクロールビューポートの実装と scrollToIndex エントリーポイントから始め、提供された StackBlitz の再現例で measureViewportOffset('top') と動作を比較してください。regular viewport と cdkVirtualScrollingElement のケースで変更を検証してください。どちらのセクションでも、100px のヘッダーオフセットがある場合を含め、項目 50 へのスクロールで項目 50 が選択される必要があります。
索引モデルが issue の本文から書いたものです。
説明
Is this a regression?
- Yes, this behavior used to work in the previous version
The previous version in which this bug was not present was
No response
Description
When scrolling by index using scrollToIndex on the viewport it doesn't take into account any content around the viewport when using cdkVirtualScrollingElement.
The logic calculates the offset only based on the itemSize without taking into account the viewport offset.
Reproduction
StackBlitz link: https://stackblitz.com/edit/qmx1v9bc
Steps to reproduce:
- In the
Regularsection clicking on the buttonScroll to item 50correctly scrolls to item 50. This is a regular viewport withoutcdkVirtualScrollingElement. - In the
With cdkVirtualScrollingElementsection clicking on the buttonScroll to item 50 (not working)it scrolls to item 48 instead of 50 as there is a 100px header above the viewport while it should scroll to item 50. - If the button
Scroll to item 50 (fixed)is clicked the scrolling works as expected as I calculate the offset myself usingviewport.measureViewportOffset('top')which is missing inscrollToIndex.
Expected Behavior
It should scroll to the correct item when using cdkVirtualScrollingElement
Actual Behavior
It scrolls without taking into account the viewport offset.
Environment
- Angular: 21.2.6
- CDK/Material: 21.1.2
- Browser(s): Chrome 146
- Operating System (e.g. Windows, macOS, Ubuntu): Windows 11
- 主要言語
- TypeScript
- スター
- 25k
- フォーク
- 6.8k
- 平均マージ
- 1日 1時間
- マージ済み PR(30日)
- 84
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
angular/components のほかの issue
-
area: material/tree docs gemini-triaged needs triage
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
angular/components#33832 ·
-
area: material/datepicker gemini-triaged P4
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
angular/components#33763 · コメント 2 件 · リアクション 3 件 ·
-
area: material/table gemini-triaged P4
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
angular/components#33709 · コメント 1 件 ·
-
area: material/table docs gemini-triaged P4
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
angular/components#33455 ·
-
area: material/core gemini-triaged P3
難易度 1/5 1時間未満 初心者へのやさしさ 78/100
angular/components#33059 · コメント 2 件 ·
angular/components の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
bcgov/bc-wallet-mobile#4761 · コメント 1 件 ·
-
external-issue to-triage
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
-
area-deployment area-integrations triage:bot-seen
難易度 2/5 半日 初心者へのやさしさ 86/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
-
refactor
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100