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

Commit a120a35

Browse files
alexandrebrasilThomasBurleson
authored andcommitted
fix(tabs): labels with fraction CSS width disabling pagination
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.
1 parent 29afb6d commit a120a35

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/components/tabs/js/tabsController.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -541,7 +541,7 @@ function MdTabsController ($scope, $element, $window, $mdConstant, $mdTabInkRipp
541541

542542
function updatePagingWidth() {
543543
var width = 1;
544-
angular.forEach(getElements().dummies, function (element) { width += element.offsetWidth; });
544+
angular.forEach(getElements().dummies, function (element) { width += element.offsetWidth + 1; });
545545
angular.element(elements.paging).css('width', width + 'px');
546546
}
547547

0 commit comments

Comments
 (0)