ionic-team / ionic-team/ionic-framework

bug: toast, icon-only buttons can get squished horizontally

Open
#27,578 5 comments 0 reactions 0 assignees View on GitHub
package: core type: bug
Dominant language
TypeScript
Stars
52.7k
Forks
13.3k
Avg merge
1d 15h
Merged PRs (30d)
51

Description

### 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 |
| --- | --- |
|![demo-current](https://github.com/ionic-team/ionic-framework/assets/60390085/c7f0b585-f1cb-4536-820a-f198df967e0a)|![demo-shrink-0](https://github.com/ionic-team/ionic-framework/assets/60390085/6a1228a1-e74a-4075-8185-b0bd138a9b9f)|
| 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:
![demo](https://github.com/ionic-team/ionic-framework/assets/60390085/68997424-e2d7-453b-829a-c2e272309624)

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).

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.