Fixes the share autocomplete scrollbars

Signed-off-by: Michael Weimann <mail@michael-weimann.eu>
This commit is contained in:
Michael Weimann 2018-12-08 20:51:06 +01:00
parent 1f3060eacf
commit 5723f77ef7
No known key found for this signature in database
GPG Key ID: 34F0524D4DA694A1
2 changed files with 18 additions and 1 deletions

View File

@ -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;

View File

@ -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);