Skip to content

mat-tab-header-pagination displaying incorrectly #8907

Closed

Description

@michaelb-01

Bug, feature request, or proposal:

bug

What is the expected behavior?

mat-tab-header-pagination should only be displayed when the tabs cannot fit inside the container.

What is the current behavior?

the mat-tab-header-pagination arrows are being displayed even though there is enough space. When I click on a tab the tabs then resize and the arrows disappear..

What are the steps to reproduce?

http://plnkr.co/edit/hX9uSOsFFas3ZnSyKprU?p=info

What is the use-case or motivation for changing an existing behavior?

Which versions of Angular, Material, OS, TypeScript, browsers are affected?

angular: 5.0.0
material: ^5.0.0-rc.2
typescript: ~2.4.2
chrome

Is there anything else we should know?

Activity

  1. julianobrasil commented on Dec 10, 2017

    @julianobrasil
    Contributor

    The example plunk you've posted seems to be working fine over here. Am I missing something in your description?

  2. michaelb-01 commented on Dec 10, 2017

    @michaelb-01
    Author

    Thats strange, still doesn't work for me.. I've attached two screenshots below. the first is how it loads for me - incorrectly, with the arrows. Then once I click on a tab the arrows disappear and it resizes and displays correctly..

    screen shot 2017-12-09 at 13 56 57

    screen shot 2017-12-09 at 13 57 15

  3. julianobrasil commented on Dec 10, 2017

    @julianobrasil
    Contributor

    I tested it in a Windows 10 + Chrome.

    image

  4. andrewseguin commented on Dec 11, 2017

    @andrewseguin
    Contributor

    Looks like you are overriding styles somewhere - the padding in your screenshots don't match what is shown in the plunker example. Please re-open with the included styles that you are using so we can fully reproduce

  5. michaelb-01 commented on Dec 11, 2017

    @michaelb-01
    Author

    @julianobrasil is that the correct functionality? Thats similar to what i'm getting and it doesn't seem right to me.. How do I get the tabs to fill the width of their container (without overflowing horizontally)?

  6. andrewseguin commented on Dec 11, 2017

    @andrewseguin
    Contributor

    It's actually supported with a built-in attribute but it is undocumented.

    On the <mat-tab-group> element, apply the mat-stretch-tabs attribute and the labels will stretch to fill the container.

    Example:
    http://plnkr.co/edit/Y8KwgieJYQs5UR2pwc5j?p=preview

  7. julianobrasil commented on Dec 12, 2017

    @julianobrasil
    Contributor

    @michaelb-01, I'm a little bit confused... what do you mean by "container"? You set up a .form-container class to be just 250px width. With this so tiny width, the paging arrows are unavoidable, even if you use the currently undocument feature mentioned by @andrewseguin. But the pagination will disapear if you get rid of width: 250px in app.component.css (considering that the form-container can fulfill all the available plunk space):

    image

  8. michaelb-01 commented on Dec 12, 2017

    @michaelb-01
    Author

    I know 250px is fairly small but i'm using this for (a relatively thin) sidenav and I only have 3 tabs (which are icons) so they should be able to fit..

    I see there's a minimum width of 160px on the tabs and 24px of padding on the left and right, is this necessary if you're using flex? Wouldn't it be more flexible to remove this and let flex do the work?

  9. michaelb-01 commented on May 2, 2018

    @michaelb-01
    Author

    I never received a good answer for this. My work around is just to override the styles:

    .mat-tab-label {
      min-width: 20px !important;
      flex: 1 !important;
      padding: 0 !important;
    }
    

    Which is fine but it would be nice if there was a 'dense' attribute so you can use tabs in small elements like sidenavs. Like I said before, is the min-width necessary? Can't it be set lower flex set to 1?

  10. tomson7777 commented on Jun 25, 2018

    @tomson7777

    any info? there is still this bug

  11. Digital-Chen commented on Jan 25, 2019

    @Digital-Chen

    I am having the exact same issue in my solution. This is really strange.

  12. YassineBouayedd commented on Jun 18, 2019

    @YassineBouayedd

    I'm also searching for a solution for this issue.

  13. jos1337 commented on Jul 20, 2019

    @jos1337

    any info? happens here aswell

  14. angular-automatic-lock-bot commented on Sep 11, 2019

    @angular-automatic-lock-bot

    This issue has been automatically locked due to inactivity.
    Please file a new issue if you are encountering a similar or related problem.

    Read more about our automatic conversation locking policy.

    This action has been performed automatically by a bot.

  15. locked and limited conversation to collaborators on Sep 11, 2019
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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions