From a93dac6a9c9cf722aa77e8d0ca38afa4518e1731 Mon Sep 17 00:00:00 2001 From: Daniel Calviño Sánchez Date: Tue, 20 Feb 2018 00:11:40 +0100 Subject: Take all visible siblings into account MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Other apps could add elements to the controls outside the creatable actions div (for example, the button to switch to the gallery), so the widths of all the visible siblings of the breadcrumbs have to be taken into account in the size calculations. Signed-off-by: Daniel Calviño Sánchez --- apps/files/js/breadcrumb.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'apps/files/js') diff --git a/apps/files/js/breadcrumb.js b/apps/files/js/breadcrumb.js index 16762f386be..4a61188e93a 100644 --- a/apps/files/js/breadcrumb.js +++ b/apps/files/js/breadcrumb.js @@ -316,7 +316,15 @@ return; } - var availableWidth = this.$el.parent().width() - this.$el.parent().find('.actions.creatable').outerWidth(true); + var siblingsWidth = 0; + this.$el.prevAll(':visible').each(function () { + siblingsWidth += $(this).outerWidth(true); + }); + this.$el.nextAll(':visible').each(function () { + siblingsWidth += $(this).outerWidth(true); + }); + + var availableWidth = this.$el.parent().width() - siblingsWidth; // If container is smaller than content // AND if there are crumbs left to hide -- cgit v1.2.3