question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

bug: md, outline select long label overflows outside of container

See original GitHub issue

Prerequisites

Ionic Framework Version

  • v4.x
  • v5.x
  • v6.x
  • Nightly

Current Behavior

When you create an item with an ion-select multiple inside it, if there are many options selected, the displayed text overflows outside the item.

image

This does not happen when there are already fewer options selected (the text to display is shorter). This makes me think that it is not a problem with the select, but with the ion-item when it is in fill=outline mode and has a very long text to display.

image

Expected Behavior

The ion-item component should always look like in case 2, discussed above

Steps to Reproduce

<ion-item fill="outline" >

    <ion-label>My select</ion-label>

    <ion-select [value]="['1','2','3','4','5']" multiple="true">
        <ion-select-option value="1">Lorem 1</ion-select-option>
        <ion-select-option value="2">Lorem 2</ion-select-option>
        <ion-select-option value="3">Lorem 3</ion-select-option>
        <ion-select-option value="4">Lorem 4</ion-select-option>
        <ion-select-option value="5">Lorem 5</ion-select-option>
    </ion-select>

</ion-item>

At startup all default options are checked, causing the component to fail. As soon as you uncheck a couple of options, the component is already displayed correctly

Code Reproduction URL

No response

Ionic Info

Ionic:

Ionic CLI : 6.17.1 (C:\Users\kikel\AppData\Roaming\npm\node_modules@ionic\cli)
Ionic Framework : @ionic/angular 6.1.8 @angular-devkit/build-angular : 13.2.6 @angular-devkit/schematics : 13.2.6 @angular/cli : 13.2.6 @ionic/angular-toolkit : 6.1.0

Capacitor:

Capacitor CLI : 3.5.1 @capacitor/android : 3.5.1 @capacitor/core : 3.5.1 @capacitor/ios : not installed

Utility:

cordova-res : 0.15.4 native-run : 1.6.0

System:

NodeJS : v14.15.4 (C:\Program Files\nodejs\node.exe) npm : 6.14.10 OS : Windows 10

Additional Information

No response

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
EinfachHanscommented, Nov 1, 2022

@liamdebeasi Removing overflow: visible doesn’t work in combination with a floating label:

Bildschirm­foto 2022-11-01 um 18 06 07

Wouldn’t it work to set a max-width: 100% on .item-inner and .input-wrapper?:

Bildschirm­foto 2022-11-01 um 18 07 45

0reactions
Joaovm3commented, Nov 17, 2022

Sure @EinfachHans. I found a workaround for this bug:

@enrique-lozano Adding the width property with any value in pixels, the text reverts to behaving as it should. image

image

However, how could I add this property manually using js?

Read more comments on GitHub >

github_iconTop Results From Across the Web

MUI - Outlined select label is not rendering properly
Solution 1: Use TextField. This is what TextField is for. It uses FormControl and InputLabel internally and make sure they work well ...
Read more >
Overflowing content - Learn web development | MDN
This lesson introduced the concept of overflow. You should understand that default CSS avoids making overflowing content invisible.
Read more >
Floating labels · Bootstrap v5.0
Create beautifully simple form labels that float over your input fields.
Read more >
Text fields - Material Design
Text fields let users enter, edit, and select text. ... The container of an outlined text field has rounded corners, while the container...
Read more >
ion-item - Ionic Framework
<ion-label> Multi-line text that should ellipsis when it is too long ... <ion-label position="floating">Floating Input: Outline (MD only)</ion-label>
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found