From 06ecb04464ac1c634a8afa0b0fb8047bada1fe00 Mon Sep 17 00:00:00 2001 From: Daniel Le Date: Thu, 22 Jun 2017 23:30:20 +0800 Subject: [PATCH] Always show the overflow indicator On the bookmarks toolbar. Fix #6869. However, there is too much space before the overflow indicator. I'm not well versed with CSS so I'd appreciate some pointers. Auditors: Test Plan: --- .../components/bookmarks/bookmarksToolbar.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) 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 } }