angular / angular/components

bug(MatDatePicker): Datepicker label overflows over Icon

Abierto
#27,952 1 comentario 4 reacciones 0 asignados Ver en GitHub
area: material/datepicker P3
Lenguaje dominante
TypeScript
Estrellas
25k
Forks
6.8k
Merge medio
1 d 8 h
PR fusionados (30 d)
91

Descripción

### Is this a regression?

- [X] Yes, this behavior used to work in the previous version

### The previous version in which this bug was not present was

14.2.7

### Description

Currently updating from v. 14.2.7 to 16.2.7 (16.2.8 on stackblitz), and I noticed that the date picker isn't handling long labels correctly. Instead of showing an ellipsis, it's overflowing to behind the calendar icon. See examples below:

**Version 16.2.8 (bad):** https://stackblitz.com/edit/8enoqa?file=src%2Fexample%2Fdatepicker-overview-example.html
![image](https://github.com/angular/components/assets/1189059/29f36b92-ab2b-4b64-8df7-da51fc008f81)

**Version 14.2.7 (good):** https://stackblitz.com/edit/c2yh3u?file=src%2Fapp%2Fdatepicker-overview-example.html
![image](https://github.com/angular/components/assets/1189059/87eabada-a32d-479d-aa50-1ca91dd58523)

**Note:** Version 15.2.9 is also showing an incorrect label.

### Reproduction

StackBlitz link: https://stackblitz.com/edit/8enoqa?file=src%2Fexample%2Fdatepicker-overview-example.html
Steps to reproduce:
1. Wrap a datepicker in a div with a set width.
2. Set mat-form-field width to 100% of the parent width.
3. Set label to be longer than available space.
4. Observe label filling entire input, including icon space, instead of overflowing with ellipsis

### Expected Behavior

The label should fit in the allotted space and not show behind the calendar icon.

![image](https://github.com/angular/components/assets/1189059/87eabada-a32d-479d-aa50-1ca91dd58523)

### Actual Behavior

The datepicker label is filling the entire input, behind the calendar icon.

![image](https://github.com/angular/components/assets/1189059/29f36b92-ab2b-4b64-8df7-da51fc008f81)

### Environment

- Angular: 16.2.7 / 16.2.8 (stackblitz)
- CDK/Material: 16.2.7
- Browser(s): Chrome
- Operating System (e.g. Windows, macOS, Ubuntu): Windows

Guía de contribución

Abrir la guía de contribución

Línea de trabajo

Comienza con la reproducción vinculada de StackBlitz y compara los ejemplos de datepicker para las versiones 14.2.7 y 16.2.8; después, sigue los estilos de la etiqueta del campo de formulario de datepicker y del icono de calendario. Se considera terminado cuando una etiqueta larga permanece dentro del espacio disponible y muestra puntos suspensivos sin aparecer detrás del icono.

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
45/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.