Skip to content

Commit aef3205

Browse files
committed
fix(material/tabs): prevent header from collapsing if there are no tabs
Fixes that the tab header was collapsing when it doesn't have any tabs which can be problematic when implementing drag&drop in it.
1 parent 6659d8f commit aef3205

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/material/tabs/_tabs-common.scss

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -383,6 +383,18 @@ $mat-tab-animation-duration: 500ms !default;
383383
display: flex;
384384
flex: 1 0 auto;
385385

386+
@include token-utils.use-tokens(
387+
tokens-mdc-secondary-navigation-tab.$prefix,
388+
tokens-mdc-secondary-navigation-tab.get-token-slots()
389+
) {
390+
// Prevents the container from collapsing if there are no tabs which can be problematic for
391+
// tab headers that use drag&drop. We use the `:not` to avoid breaking existing apps that
392+
// were customizing the height of by setting the `height` instead of going through the token.
393+
&:not(:has(.mdc-tab)) {
394+
@include token-utils.create-token-slot(min-height, container-height);
395+
}
396+
}
397+
386398
// We need to set the parent here explicitly, in order to prevent the alignment
387399
// from any parent tab groups from propagating down to the children when nesting.
388400
// Note that these are used as inputs so they shouldn't be changed to `mat-mdc-`.

0 commit comments

Comments
 (0)