ionic-team / ionic-team/ionic-framework
bug: toast, icon-only buttons can get squished horizontally
- Lenguaje dominante
- TypeScript
- Estrellas
- 52.7k
- Forks
- 13.3k
- Merge medio
- 1 d 15 h
- PR fusionados (30 d)
- 51
Descripción
### Prerequisites
- [X] I have read the [Contributing Guidelines](https://github.com/ionic-team/ionic-framework/blob/main/.github/CONTRIBUTING.md#creating-an-issue).
- [X] I agree to follow the [Code of Conduct](https://ionicframework.com/code-of-conduct).
- [X] I have searched for [existing issues](https://github.com/ionic-team/ionic-framework/issues) that already report this problem, without success.
### Ionic Framework Version
v6.x
### Current Behavior
The element `.toast-button-icon-only` is squeezed on smaller screens with multiple buttons.
We could prevent this by adding `flex-shrink: 0` to the button elements to keep the icon size.
In my case I display the `::part(container)` in `flex: column` and `word-wrap: break-word` because the space on the right side is too small. The problem is, that I cannot select children of shadow parts. So I cannot select the icon button and cannot set flex-shrink to the container in this case.
### Expected Behavior
The icon size should keep size regardless of the parent size. Don't squeezed the circle to an oval (width) what cause the icon to shrink.
### Steps to Reproduce
Create a toast with some custom buttons. The first button with text. The second button just with icon only "close" and cancel role like the default button. Select part container and set flex-direction column. And word-wrap: break-word. But I doubt that my customizations affects that.
### Code Reproduction URL
https://stackblitz.com/edit/ionic6-angular13-ga1wv5?file=src%2Fapp%2Fapp.component.ts
### Ionic Info
Ionic 6 (ionic info not working in my monorepo)
### Additional Information
| Current | Shrink 0 |
| --- | --- |
|||
| The icon is squeezed and size changed. It shrinks. In some case until it's completly invisible. | The icon size is stable. |
Another demo with some fixes in button and text wrap:

I know, in this record the screen size is really small what you never have in real life. But this is just for demo reason. In my app I test with min width of 320px. But anyway...
Maybe another issue but the buttons or its text should wrap. As you see that they overflow out of screen.
https://ionicframework.com/docs/v6/api/toast
See [demo](https://stackblitz.com/edit/ionic6-angular13-ga1wv5?file=src%2Fapp%2Fapp.component.ts).
Guía de contribución
Línea de trabajo
Start at the Ionic toast component and reproduce the layout using the linked StackBlitz example, with multiple buttons and a narrow container. Check the toast button styling, especially the icon-only button, and verify that its icon keeps a stable width without causing button text to overflow. Done means the icon button no longer becomes oval or disappears on small screens.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- css, typescript
- Área
- frontend
- Tipo de issue
- Error
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Estado de actividad
- Estancado
- Claridad
- Bastante claro
- Aptitud para principiantes
- 52/100