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

Commit

Permalink
fix(tabs): labels with fraction CSS width disabling pagination
Browse files Browse the repository at this point in the history
When the md-tab-label CSS width is calculated to a fraction numbem, its
value and element.offsetWidth don't match. When the paging container's
width is calculated, depending on how the offsetWidth of each label is
truncated/rounded, the resulting width is smaller then the actual sum of
all labels, and that breaks the line and forces the last label to go to
next line, and its offsetLeft to be zero. That behaviour disables the next
page button, causing the pagination to not work. The new width calculation
adds 1px to the offsetWidth to account for rounding/truncating errors,
resulting in a slightly bigger paging container.

Fixes #5794. Fixes #5770. Fixes #5692. Closes #5801.
  • Loading branch information
alexandrebrasil authored and ThomasBurleson committed Nov 23, 2015
1 parent 29afb6d commit a120a35
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/components/tabs/js/tabsController.js
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,7 @@ function MdTabsController ($scope, $element, $window, $mdConstant, $mdTabInkRipp

function updatePagingWidth() {
var width = 1;
angular.forEach(getElements().dummies, function (element) { width += element.offsetWidth; });
angular.forEach(getElements().dummies, function (element) { width += element.offsetWidth + 1; });
angular.element(elements.paging).css('width', width + 'px');
}

Expand Down

0 comments on commit a120a35

Please sign in to comment.