From 1f3060eacf060e580df16098728eb041146b54e4 Mon Sep 17 00:00:00 2001 From: Michael Weimann Date: Sat, 8 Dec 2018 13:05:25 +0100 Subject: Fixes the share autocomplete #12832 Signed-off-by: Michael Weimann --- core/css/jquery-ui-fixes.scss | 1 + 1 file changed, 1 insertion(+) (limited to 'core') diff --git a/core/css/jquery-ui-fixes.scss b/core/css/jquery-ui-fixes.scss index eab22e70d62..de8d7729e97 100644 --- a/core/css/jquery-ui-fixes.scss +++ b/core/css/jquery-ui-fixes.scss @@ -173,6 +173,7 @@ padding: 0; .ui-menu-item a { color: var(--color-text-lighter); + display: block; padding: 4px 4px 4px 14px; &.ui-state-focus, &.ui-state-active { -- cgit v1.2.3 From 5723f77ef720daf7ae1d5d697472ddf52c7f9f8c Mon Sep 17 00:00:00 2001 From: Michael Weimann Date: Sat, 8 Dec 2018 20:51:06 +0100 Subject: Fixes the share autocomplete scrollbars Signed-off-by: Michael Weimann --- core/css/jquery-ui-fixes.scss | 8 ++++++++ core/js/sharedialogview.js | 11 ++++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) (limited to 'core') diff --git a/core/css/jquery-ui-fixes.scss b/core/css/jquery-ui-fixes.scss index de8d7729e97..31714dc34b3 100644 --- a/core/css/jquery-ui-fixes.scss +++ b/core/css/jquery-ui-fixes.scss @@ -171,6 +171,14 @@ .ui-autocomplete { &.ui-menu { padding: 0; + + /* scrolling starts from three items, + * so hide overflow and scrollbars for a clean layout */ + &.item-count-1, + &.item-count-2 { + overflow-y: hidden; + } + .ui-menu-item a { color: var(--color-text-lighter); display: block; diff --git a/core/js/sharedialogview.js b/core/js/sharedialogview.js index e2ef8db90eb..a433570b13d 100644 --- a/core/js/sharedialogview.js +++ b/core/js/sharedialogview.js @@ -772,7 +772,16 @@ event.preventDefault(); }, source: this.autocompleteHandler, - select: this._onSelectRecipient + select: this._onSelectRecipient, + open: function() { + var autocomplete = $(this).autocomplete('widget'); + var numberOfItems = autocomplete.find('li').size(); + autocomplete.removeClass('item-count-1'); + autocomplete.removeClass('item-count-2'); + if (numberOfItems <= 2) { + autocomplete.addClass('item-count-' + numberOfItems); + } + } }).data('ui-autocomplete')._renderItem = this.autocompleteRenderItem; $shareField.on('keydown', null, shareFieldKeydownHandler); -- cgit v1.2.3