angular / angular/components

CDK ScrollingModule: scrollToIndex() smooth behavior for all browsers

Offen
#13,613 6 Kommentare 4 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
area: cdk/scrolling feature P3
Vorherrschende Sprache
TypeScript
Sterne
25k
Forks
6.8k
Ø Merge
1 T. 8 Std.
Gemergte PRs (30 T.)
91

Beschreibung

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

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

Beginne mit der Untersuchung des CDK ScrollingModule und seiner virtual-scroll-API, insbesondere von scrollToIndex() und measureScrollOffset(). Vergleiche das gemeldete Verhalten beim Smooth Scrolling in Chrome, Firefox, Edge und Safari. Als abgeschlossen gilt die Aufgabe, wenn entweder browserübergreifendes Smooth Scrolling über scrollToIndex() funktioniert oder die API den Scroll-Offset des Zielindexes für eine zuverlässige Umgehungslösung bereitstellt.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
angular, typescript
Bereich
frontend
Issue-Typ
Feature
Schwierigkeit
5/5
Geschätzter Aufwand
Über eine Woche
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
25/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.