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

Commit 5b799e2

Browse files
clshortfusemmalerba
authored andcommitted
fix(tabs): remove manually pagination sizing algorithm (#10136)
Since tabs now use flexbox for sizing, manually sizing is no longer needed. This solves issues related tabs inside flexible containers like dialogs. * Remove updatePagingWidth() function * Revert width to default values Fixes #9429
1 parent f8fd076 commit 5b799e2

File tree

3 files changed

+1
-46
lines changed

3 files changed

+1
-46
lines changed

src/components/tabs/js/tabsController.js

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -606,23 +606,10 @@ function MdTabsController ($scope, $element, $window, $mdConstant, $mdTabInkRipp
606606
* Updates whether or not pagination should be displayed.
607607
*/
608608
function updatePagination () {
609-
updatePagingWidth();
610609
ctrl.maxTabWidth = getMaxTabWidth();
611610
ctrl.shouldPaginate = shouldPaginate();
612611
}
613612

614-
/**
615-
* Sets or clears fixed width for md-pagination-wrapper depending on if tabs should stretch.
616-
*/
617-
function updatePagingWidth() {
618-
var elements = getElements();
619-
if (shouldStretchTabs()) {
620-
angular.element(elements.paging).css('width', '');
621-
} else {
622-
angular.element(elements.paging).css('width', calcPagingWidth() + 'px');
623-
}
624-
}
625-
626613
/**
627614
* Calculates the width of the pagination wrapper by summing the widths of the dummy tabs.
628615
* @returns {number}

src/components/tabs/tabs.scss

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -159,13 +159,11 @@ md-pagination-wrapper {
159159
display: flex;
160160
transition: transform $swift-ease-in-out-duration $swift-ease-in-out-timing-function;
161161
position: absolute;
162-
width: 999999px;
163162
@include rtl-prop(left, right, 0, auto);
164163
transform: translate3d(0, 0, 0);
165164
&.md-center-tabs {
166165
position: relative;
167-
width: auto;
168-
margin: 0 auto;
166+
justify-content: center;
169167
}
170168
}
171169

src/components/tabs/tabs.spec.js

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -515,36 +515,6 @@ describe('<md-tabs>', function () {
515515
}));
516516
});
517517

518-
describe('md-pagination-wrapper', function () {
519-
var template = '<md-tabs md-stretch-tabs="{{stretch}}">' +
520-
' <md-tab label="label!">content!</md-tab>' +
521-
'</md-tabs>';
522-
523-
it('should have inline width if md-stretch-tabs="never"',
524-
inject(function ($timeout, $document) {
525-
var scope = { 'stretch': 'never' };
526-
var element = setup(template, scope);
527-
// Appending to body is required for style checks
528-
angular.element($document.body).append(element);
529-
// $timeout.flush required to run nextTick inside init();
530-
$timeout.flush();
531-
expect(element.find('md-pagination-wrapper').attr('style').indexOf('width')).toBeGreaterThan(-1);
532-
element.remove();
533-
}));
534-
535-
it('should not have inline width if md-stretch-tabs="always"',
536-
inject(function ($timeout, $document) {
537-
var scope = { 'stretch': 'always' };
538-
var element = setup(template, scope);
539-
// Appending to body is required for style checks
540-
angular.element($document.body).append(element);
541-
// $timeout.flush required to run nextTick inside init();
542-
$timeout.flush();
543-
expect(element.find('md-pagination-wrapper').attr('style').indexOf('width')).toBe(-1);
544-
element.remove();
545-
}));
546-
});
547-
548518
describe('no element content', function() {
549519
it('should not add the `md-no-tab-content` class if the element has content', function() {
550520
var tabs = setup(

0 commit comments

Comments
 (0)