diff --git a/app/renderer/components/bookmarks/bookmarksToolbar.js b/app/renderer/components/bookmarks/bookmarksToolbar.js index 5b77928701d..79b32bda79b 100644 --- a/app/renderer/components/bookmarks/bookmarksToolbar.js +++ b/app/renderer/components/bookmarks/bookmarksToolbar.js @@ -143,12 +143,30 @@ class BookmarksToolbar extends ImmutableComponent { const chevronWidth = props.showFavicon && noParentItems.getIn([i, 'folderId']) ? this.chevronWidth : 0 if (props.showFavicon && props.showOnlyFavicon) { widthAccountedFor += this.padding + iconWidth + chevronWidth + + if (widthAccountedFor >= props.windowWidth - overflowButtonWidth) { + widthAccountedFor -= this.padding + iconWidth + chevronWidth + i-- + + break + } } else { const text = noParentItems.getIn([i, 'customTitle']) || noParentItems.getIn([i, 'title']) || noParentItems.getIn([i, 'location']) widthAccountedFor += Math.min(calculateTextWidth(text, `${this.fontSize} ${this.fontFamily}`) + this.padding + iconWidth + chevronWidth, this.maxWidth) + + if (widthAccountedFor >= props.windowWidth - overflowButtonWidth) { + widthAccountedFor -= Math.min(calculateTextWidth(text, `${this.fontSize} ${this.fontFamily}`) + this.padding + iconWidth + chevronWidth, this.maxWidth) + i-- + + break + } } widthAccountedFor += margin + if (widthAccountedFor >= props.windowWidth - overflowButtonWidth) { + widthAccountedFor -= margin + i-- + break } }