diff options
author | Michael Weimann <mail@michael-weimann.eu> | 2018-12-08 20:51:06 +0100 |
---|---|---|
committer | Michael Weimann <mail@michael-weimann.eu> | 2018-12-08 20:51:06 +0100 |
commit | 5723f77ef720daf7ae1d5d697472ddf52c7f9f8c (patch) | |
tree | 8df6ee88fb57f74a7be0ae86b791f9eaeb82ccfa | |
parent | 1f3060eacf060e580df16098728eb041146b54e4 (diff) | |
download | nextcloud-server-5723f77ef720daf7ae1d5d697472ddf52c7f9f8c.tar.gz nextcloud-server-5723f77ef720daf7ae1d5d697472ddf52c7f9f8c.zip |
Fixes the share autocomplete scrollbars
Signed-off-by: Michael Weimann <mail@michael-weimann.eu>
-rw-r--r-- | core/css/jquery-ui-fixes.scss | 8 | ||||
-rw-r--r-- | core/js/sharedialogview.js | 11 |
2 files changed, 18 insertions, 1 deletions
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); |