Ionic-framework: bug: scrollable ion-segment doesn't expand ion-buttons when needed

Created on 20 Feb 2020  路  8Comments  路  Source: ionic-team/ionic-framework

Bug Report

Ionic version:
Ionic 5.0.1
Current behavior:

When you use a ion-segment with many ion-segment-buttons and set it as scrollable="true", all the buttons' width is 90px, even if the inner content doesn't fit.

Expected behavior:
The ion-segment-buttons should expand to fit the label content.

Steps to reproduce:
Create an ion-segment with 20-30 ion-segment buttons including large words

Other information:

Ionic info:

Ionic:

   Ionic CLI                     : 6.1.0 (/usr/local/lib/node_modules/@ionic/cli)
   Ionic Framework               : @ionic/angular 5.0.1
   @angular-devkit/build-angular : 0.900.3
   @angular-devkit/schematics    : 9.0.3
   @angular/cli                  : 9.0.3
   @ionic/angular-toolkit        : 2.0.0

Capacitor:

   Capacitor CLI   : 1.2.1
   @capacitor/core : 1.5.0

Cordova:

   Cordova CLI       : 9.0.0 ([email protected])
   Cordova Platforms : none
   Cordova Plugins   : no whitelisted plugins (4 plugins total)

Utility:

   cordova-res                          : not installed
   native-run (update available: 0.3.0) : 0.2.8

System:

   Android SDK Tools : 26.1.1 (/Users/xxx/Library/Android/sdk)
   ios-deploy        : 1.9.4
   ios-sim           : 8.0.0
   NodeJS            : v12.15.0 (/usr/local/bin/node)
   npm               : 6.13.7
   OS                : macOS Mojave
   Xcode             : Xcode 11.3.1 Build version 11C504
core bug

Most helpful comment

@simonhaenisch The changes I made were made to Ionic Core, I just happened to post the Angular dev build version since that was what OP was using.

I used the dev build on your CodePen and it looks like the issue is fixed: https://codepen.io/liamdebeasi/pen/jOPKOvL?editors=1100

All 8 comments

If you add min-width: auto; to the inside ion-segment-buttons it works like in Ionic 4

Thanks for the issue. Can you try the following dev build and let me know if it resolves the issue?

npm i @ionic/[email protected]

@liamdebeasi Mine is still the same

@lapid3 Can you provide a repo with the code required to reproduce the issue?

@liamdebeasi I don't think this is just related to @ionic/angular. We have the same issue in a Stencil + Ionic (5) app and when I add ion-segment-button { min-width: auto; } (as mentioned above), the issue is gone.

Codepen: https://codepen.io/simonhaenisch/pen/xxGjvPb?editors=1000

@simonhaenisch The changes I made were made to Ionic Core, I just happened to post the Angular dev build version since that was what OP was using.

I used the dev build on your CodePen and it looks like the issue is fixed: https://codepen.io/liamdebeasi/pen/jOPKOvL?editors=1100

Thanks for the issue. This has been resolved via https://github.com/ionic-team/ionic/pull/20763 and will be available in an upcoming release of Ionic Framework.

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

brandyscarney picture brandyscarney  路  3Comments

SebastianGiro picture SebastianGiro  路  3Comments

alan-agius4 picture alan-agius4  路  3Comments

MrBokeh picture MrBokeh  路  3Comments

aslamj picture aslamj  路  3Comments