-
Notifications
You must be signed in to change notification settings - Fork 6.8k
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
[Tabs] Md-tab height: 100% does not give all height of group #4591
Comments
Closing since this is a question rather than an issue. Please feel free to ask our great community in other avenues such as StackOverflow or Gitter. Note that it will help if you re-create your template in a plunkr so others can assist you better. |
But In my opinion @andrewseguin it is more a problem than a question. This is a plunker that recreate the problem https://plnkr.co/edit/eyklxDVFbsxEnLKyCbi1?p=preview And this is a screenshot of my custom problem https://i.stack.imgur.com/8uDvd.png The problem is that the content inside of a |
Thanks for the example, I see that the problem is in the Next time it definitely helps to follow the issue template and provide reproduction steps. Otherwise it's harder for us to know what is being described and how to replicate it. Fix has been made in #4631 |
Sorry for the bad news, but it looks like we'll need to dig deeper into coming up with a solution. Safari doesn't quite match the flexbox spec and translate height down correctly to children. This would be a great bug for community contribution |
Thanks for your work! |
@andrewseguin I've had to add an absolute positioned element in my nested flexbox layouts when I wanted 100% height. This Plunk adds the fix you made and tweaks the mat-body-content class:
Tested on my iPhone - os10.3.2. SO links for reference: link, link |
Did some digging, it seems PR #1788 introduced this issue, In the tab-group.scss, the flex-grow: 1 was removed from the mat-tab-body-wrapper class and the mat-tab-body-active class was introduced which sets the position: relative. This overrides the position: absolute on the mat-tab-body class which comes from the mat-fill include. |
@RobJacobs I played around with the problem and your solution and as soon as the div actually contains content, I get weird behavior with the absolute positioning. Here's your Plunk with content. Notice the Scrollbar, that's not supposed to be there. When I set the absolute positioning onto the div with the height:100% style it's fixed. See here. I have no idea if this helps anyone, but I just wanted to bring it up. |
@KeTr Not sure what's going on with the p element, but that's what is causing the scroll bars to appear. The user-agent style adds a 16px margin top and bottom to p elements and for some reason that is leaking out to the parent div. I created another plunk that abstracts the classes/styles to help diagnose the issue. |
I played around with this some more, my previous idea with absolute positioning broke the dynamic-tab-height implementation. The only way I've gotten this to work so far is by making all the child tab body containers flex. Adding
The important flag on the .mat-tab-body is to override the display: block style already existing on that class, obviously the real fix would replace the display: block and !important would not be needed. This also seems to fix the issue @KeTr uncovered using a 'p' element. I also changed the inner div style from: height: 100% to: flex-grow: 1. plunk has been updated, tested on a Mac with OSX v 10.11.6 with Safari version 10.0.3 |
@RobJacobs could you make a pull request with your fix? |
Following change help me sort my issue:- /deep/.mat-tab-body-wrapper{ |
The following also works for me (same as above without important).
Angular docs says /deep/ is deprecated, what's the alternative to deep? |
@andrewseguin @mmalerba If @CDDelta is working here I suggest to add the "has pr" label to this issue. |
Is there any reason why the PR hasn't still been merged after 5 months? |
I think flex-grow should be prefered. Otherwise it's as of now the only solution that worked for me. Cheers!
|
This works for me! 🆗 html:
scss:
|
@andrewseguin according to your answer #15839 (comment) does this issue still make sense? |
Hi,
I'm having problems to adjust content of a tab to 100% of height of md-tab-group
For example:
My problem is that
md-tab-group
expands hisheight
to total ofheight
. But the atributeheight
ofmd-tab
doesn't fit to 100% ofmd-tab-group
.Because of that the content, even if I set the height to 100% it doesn't fit to 100% of
height
If I set thet
height
attribute of the<div>
to for example 500px it works correctlyI have this problem since I added
<!doctype html>
to my index.htmlVersions: Beta.5
Angular 4
What would be doing wrong?
The text was updated successfully, but these errors were encountered: