-
Notifications
You must be signed in to change notification settings - Fork 6.8k
[Tabs] Ink bar does not update when container resizes #6130
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
+1 |
Is there any news about this ? I updated the plunker to latest angular & material2, and still same issue. BTW it seems now that the sidenav is overlapping tabs |
Is there any workaround for this issue? |
Hope this gets looked at soon, tried a few things to resolve this but no luck. |
The issue to me appears that the _realignInkBar is only triggered by the _viewportRuler which is controlled by a window resize event. I attempted playing around with MutationObserver but unfortunately that is not able to monitor the values in the _tabListContainer.nativeElement that we would need for that to work. Without a way to actively monitor either the clientWidth or offsetWidth values and trigger either an event or some type of changeDetection when those values are modified... I was stuck with the following hacky solution that allowed me to realign the inkBar after my resizing event. Not pretty but got the job done in my scenario. Hope this helps others looking for a workaround to this issue. setTimeout(() => { |
I personally fixed this issue in my project (i'm using a sidenav) by calling the private method _alignInkBar :
|
@spanja thank you for sharing, your workaround is much more elegant! |
@spanja Thanks for your workaround. It appears An issue I have is that the For now I'm doing something similar to @spanja except I'm using
The major downside to this is that the A minor downside to this is that the Is there any news on this bug? Thanks EDIT: |
There is same issue with pagination arrows, if the container (not the window itself) is resized, pagination arrows won't recalculate, so I used similar hack for the time being:
|
@pmilic021 When do you call the method updatePagination()? |
@JGSolutions I had some animation for enlarging a div to full-screen mode, so I ran it at the end of the animation: |
+1 |
+1 |
The ink bar should have left and width set as a percentage. To avoid issues when tabs overflow the visible space the width of the ink bar parent should match the total space for the tabs and it should be moved left right with overflow hidden when tabs change. For example, when you have 4 tabs. The element.style set by the library should reflect the following: .mat-ink-bar {
left: 50%;
width: 25%;
} This would yield an ink bar that resizes with no API hacks that shows under the 3rd tab. Having 2 tabs to the left would be calculated with Additional styling would be required to deal with tabs that overflow the visible space. |
Same problem here... still present after more than 3 years |
This is probably unlikely to be fixed since it is not an issue in the experimental MDC tabs version |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Bug, feature request, or proposal:
Bug :
Add stretched tabs in a sidenav container with side mode.
When the sidenav is resized with dynamic content (ie sidenav labels are translated), the md-ink-bar is not resized
That happens too with md-tab-nav-bar and full width tabs
What is the expected behavior?
md-ink-bar should be resized
What is the current behavior?
tabs are well resized but not md-ink-bar
What are the steps to reproduce?
plunkr :
https://plnkr.co/edit/q80nul7KYS8sJ0e8vwwi?p=preview
stackblitz :
https://stackblitz.com/edit/angular-material2-issue-6efd2m?file=main.ts
Which versions of Angular, Material, OS, TypeScript, browsers are affected?
ng 5.1.1
material 5.0.1
chrome 61
Is there anything else we should know?
The text was updated successfully, but these errors were encountered: