angular / angular/components

CDK ScrollingModule: scrollToIndex() smooth behavior for all browsers

Đang mở
#13,613 6 bình luận 4 reaction 0 người được giao Xem trên GitHub
area: cdk/scrolling feature 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ả

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

![test](https://user-images.githubusercontent.com/8130692/46931358-7cd50b80-d053-11e8-946d-a31256347893.gif)

#### Which versions of Angular, Material, OS, TypeScript, browsers are affected?

CDK: **7.0.0-beta.1**

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

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

Hướng nghiên cứu

Bắt đầu bằng cách kiểm tra CDK ScrollingModule và API virtual-scroll của nó, đặc biệt là scrollToIndex() và measureScrollOffset(). So sánh hành vi smooth scrolling được báo cáo trong Chrome, Firefox, Edge và Safari. Được xem là hoàn tất khi smooth scrolling trên nhiều trình duyệt hoạt động thông qua scrollToIndex() hoặc API cung cấp scroll offset của index đích để có một giải pháp thay thế đáng tin cậy.

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
Tính năng
Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
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
25/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.