angular / angular/components

CDK ScrollingModule: scrollToIndex() smooth behavior for all browsers

Aperta
#13,613 6 commenti 4 reazioni 0 assegnatari Vedi su GitHub
area: cdk/scrolling feature P3
Lingua principale
TypeScript
Stelle
25k
Fork
6.8k
Merge medio
1g 8h
PR unite (30g)
91

Descrizione

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

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Inizia esaminando il CDK ScrollingModule e la relativa API di virtual-scroll, in particolare scrollToIndex() e measureScrollOffset(). Confronta il comportamento di smooth scrolling segnalato in Chrome, Firefox, Edge e Safari. Il lavoro è completato quando lo smooth scrolling tra browser funziona tramite scrollToIndex() oppure l’API espone l’offset di scorrimento dell’indice di destinazione per una soluzione alternativa affidabile.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
angular, typescript
Ambito
frontend
Tipo di issue
Funzionalità
Difficoltà
5/5
Tempo stimato
Più di una settimana
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
25/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.