CDK ScrollingModule: scrollToIndex() smooth behavior for all browsers
- 主要语言
- TypeScript
- 星标
- 25k
- 派生
- 6.8k
- 平均合并
- 1 天 8 小时
- 30 天内合并 PR
- 91
描述
#### Bug, feature request, or proposal:
Feature request
#### What is the expected behavior?
Ability to scroll to index smoothly using `viewPort.scrollToIndex(currIndex, 'smooth')` on all browsers
#### What is the current behavior?
It works on _Chrome_ and _Firefox_ but it doesn't work on _Edge_ and _Safari_
#### What is the use-case or motivation for changing an existing behavior?
Currently, there is no way for the developer to get a cross-browser smooth scrolling with the CDK Virtual Scroll component
Even if the developer has to develop his own smooth scroll function, then he has to get the scroll offset of the target item, which is not possible with the current API
The only available function for measuring the scroll offset is `viewPort.measureScrollOffset('start')` which return the offset of the view, but there is no function to measure the scroll offset of a specific item
We either need `viewPort.measureIndexOffset(index)` function to develop it or a built-in cross-browser smooth scroll feature
In my case I am using the **ScrollingModule** to develop a carousel but the smooth scroll does not work on mobile browsers, Safari and Edge

#### Which versions of Angular, Material, OS, TypeScript, browsers are affected?
CDK: **7.0.0-beta.1**
贡献指南
调研方向
首先检查 CDK ScrollingModule 及其 virtual-scroll API,尤其是 scrollToIndex() 和 measureScrollOffset()。比较 Chrome、Firefox、Edge 和 Safari 中报告的 smooth-scroll 行为。完成的标准是:跨浏览器的 smooth scrolling 能够通过 scrollToIndex() 正常工作,或者 API 暴露目标索引的滚动偏移量,以便实现可靠的变通方案。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- angular, typescript
- 领域
- frontend
- Issue 类型
- 功能
- 难度
- 5/5
- 预计耗时
- 一周以上
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 25/100