Skip to content
This repository was archived by the owner on Sep 5, 2024. It is now read-only.

Commit 44e6984

Browse files
author
Robert Messerle
committed
fix(tabs): fixes md-center-tabs css bug
Closes #2638
1 parent 27075c7 commit 44e6984

File tree

3 files changed

+12
-5
lines changed

3 files changed

+12
-5
lines changed

src/components/tabs/js/tabsController.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,8 @@ function MdTabsController ($scope, $element, $window, $timeout, $mdConstant, $md
130130

131131
function handleWindowResize () {
132132
ctrl.lastSelectedIndex = $scope.selectedIndex;
133-
updateInkBarStyles();
134133
ctrl.offsetLeft = fixOffset(ctrl.offsetLeft);
134+
$timeout(updateInkBarStyles, 0, false);
135135
}
136136

137137
function processQueue () {

src/components/tabs/js/tabsDirective.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,10 @@ function MdTabs ($mdTheming, $mdUtil, $compile) {
123123
tabindex="0"\
124124
aria-activedescendant="tab-item-{{$mdTabsCtrl.tabs[$mdTabsCtrl.focusIndex].id}}"\
125125
ng-focus="$mdTabsCtrl.redirectFocus()"\
126-
ng-class="{ \'md-paginated\': $mdTabsCtrl.shouldPaginate() }"\
126+
ng-class="{\
127+
\'md-paginated\': $mdTabsCtrl.shouldPaginate(),\
128+
\'md-center-tabs\': $mdTabsCtrl.shouldCenterTabs()\
129+
}"\
127130
ng-keydown="$mdTabsCtrl.keydown($event)"\
128131
role="tablist">\
129132
<md-pagination-wrapper\

src/components/tabs/tabs.scss

+7-3
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,10 @@ md-tabs-canvas {
133133
&.md-paginated {
134134
margin: 0 $tabs-paginator-width;
135135
}
136+
&.md-center-tabs {
137+
display: flex;
138+
flex-direction: column;
139+
}
136140
}
137141
md-pagination-wrapper {
138142
@include pie-clearfix;
@@ -144,10 +148,10 @@ md-pagination-wrapper {
144148
left: 0;
145149
transform: translate3d(0, 0, 0);
146150
&.md-center-tabs {
151+
position: relative;
147152
width: initial;
148-
float: left;
149-
left: 50%;
150-
transform: translate3d(-50%, 0, 0);
153+
flex: 1;
154+
margin: 0 auto;
151155
}
152156
}
153157
md-tabs-content-wrapper {

0 commit comments

Comments
 (0)