angular / angular/components

[Textarea] Scroll position changes unexpectedly

Abierto
#8,992 15 comentarios 20 reacciones 0 asignados Ver en GitHub
area: material/input P3
Lenguaje dominante
TypeScript
Estrellas
25k
Forks
6.8k
Merge medio
1 d 8 h
PR fusionados (30 d)
91

Descripción

#### Bug, feature request, or proposal:
Bug

#### What is the expected behavior?
When filling a textarea, we should see what we are writing :-)

#### What is the current behavior?
Under some conditions, writing inside a textarea with autoSize directive makes the page scroll position changes (we get scrolled up ? sorry for my english).

#### What are the steps to reproduce?
To reproduce my issue:
- With latest firefox (tested on macOS), open https://angular-material2-issue-pnr2sj.stackblitz.io/
- Scroll down the page.
- Enter the textarea and press any key.
- Your scroll position changes on the page, most of the textarea content isn't visible anymore, which is very annoying for writing.

It also happens on iOS 11 when the textarea is inside a parent with scroll overflow (not the case on the stackblitz example, but I can create another one if needed). I cannot reproduce it on Chrome and I haven't tested other browsers.

I believe the issue is related to [this line](https://github.com/angular/material2/blob/master/src/lib/input/autosize.ts#L197), the parent's height get shorter for an instant which explains we get scrolled up.

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

Guía de contribución

Abrir la guía de contribución

Línea de trabajo

Comienza con src/lib/input/autosize.ts alrededor de la línea 197 y reproduce el problema usando el ejemplo enlazado de StackBlitz en Firefox; después compara el comportamiento cuando la textarea está dentro de un elemento padre con scroll overflow en iOS. El trabajo estará terminado cuando escribir en una textarea autoSize ya no cambie la posición de desplazamiento de la página ni la del elemento padre y el contenido que se está introduciendo siga siendo visible.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
angular, typescript
Área
frontend
Tipo de issue
Error
Dificultad
3/5
Tiempo estimado
1-2 días
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
35/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.