Skip to content

bug: segment button does not truncate long text correctly #16532

Closed

Description

@peterpeterparker

Ionic Info

Ionic-angular v4-beta.17

Describe the Bug
Ionic-Angular v4-beta.17 doesn't handle correctly long text in ion-segment-button. It seems that no max width applies and therefore that no ellipsis would be displayed.

Steps to Reproduce

  1. Git clone https://github.com/peterpeterparker/ionic-segment-texxt
  2. cd ionic-segment-texxt
  3. nom install
  4. ionic serve

Related Code
https://github.com/peterpeterparker/ionic-segment-texxt

Expected Behavior
As previously, I would expect that long text would be trimmed to the max width of the ion-segment-button and display with ellipsis

Additional Context

capture d ecran 2018-11-30 a 08 34 30

Activity

  1. manucorporat commented on Nov 30, 2018

    @manucorporat
    Contributor

    Hey David! can you submit a PR? let me know if you need any assistance!

  2. added
    help wanted
    on Nov 30, 2018
  3. peterpeterparker commented on Nov 30, 2018

    @peterpeterparker
    ContributorAuthor

    @manucorporat I wish but, not joking, I didn't figure out how to solves it properly 🤔

  4. added
    package: core
    type: bug
    on Nov 30, 2018
  5. brandyscarney commented on Nov 30, 2018

    @brandyscarney
    Member

    Thanks! I was able to reproduce this. I'm not sure of the best solution right now without looking into it more, but as a temporary fix you can add the following:

    ion-segment-button ion-label {
      max-width: 100px;
      overflow: hidden;
    }
    

    See this codepen here: https://codepen.io/brandyscarney/pen/aQPQaz?ionic:mode=ios

    Note: make sure you are wrapping your segment text in an ion-label and if you are placing icons on the top it needs to have the layout="icon-top" property added to look the best. This is something I want to look into fixing (the requirement to set the layout) but I haven't had a chance to yet.

    @camwiegert do you have any ideas on this? Maybe something with label changed in the shuffle?

  6. peterpeterparker commented on Dec 1, 2018

    @peterpeterparker
    ContributorAuthor

    thx a lot @brandyscarney, your solution works just fine right now 👍 don't know why I was trying so hard to use span 😂

    p.s.: in my app, I had to do the following for a ion-segment I use inside an ion-content, if that could help someone too:

    ion-segment-button {
        width: calc(100% / 4);
    
        ion-label {
            max-width: calc(90vw / 4);
        }
    }
    
  7. changed the title [-][v4-beta.17] ion-segment > ion-segment-button > span.width & ellipsis not ok[/-] [+]bug: segment button does not truncate long text correctly[/+] on Feb 3, 2023
  8. added
    type: bug
    and removed
    help wanted
    type: bug
    on Feb 3, 2023
  9. added a commit that references this issue on May 24, 2023
    448e63f
  10. liamdebeasi commented on Jun 5, 2023

    @liamdebeasi
    Contributor

    Hi everyone,

    This was fixed in #27457 and will be available in an upcoming minor release of Ionic 7.

  11. ionitron-bot commented on Jul 5, 2023

    @ionitron-bot

    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.

  12. locked and limited conversation to collaborators on Jul 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    package: coretype: bug

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions