Skip to content

Commit

Permalink
Elastic: Fix position and style of auto-complete dropdown on small sc…
Browse files Browse the repository at this point in the history
…reens (#6951)
  • Loading branch information
alecpl committed Oct 5, 2019
1 parent e7ebff5 commit ed085db
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 30 deletions.
1 change: 1 addition & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ CHANGELOG Roundcube Webmail
===========================

- Elastic: Resizeable columns (#6929)
- Elastic: Fix position and style of auto-complete dropdown on small screens (#6951)
- Redis: Improve error handling and phpredis 5.X support (#6888)
- Fix bug where cache keys were not case-sensitive on MySQL/MSSQL (#6942)

Expand Down
16 changes: 11 additions & 5 deletions program/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -5939,7 +5939,7 @@ function rcube_webmail()
if (!this.ksearch_pane) {
ul = $('<ul>');
this.ksearch_pane = $('<div>')
.attr({id: 'rcmKSearchpane', role: 'listbox'})
.attr({id: 'rcmKSearchpane', role: 'listbox', 'class': 'select-menu inline'})
.css({position: 'absolute', 'z-index': 30000})
.append(ul)
.appendTo(is_framed ? parent.document.body : document.body);
Expand All @@ -5962,7 +5962,10 @@ function rcube_webmail()
this.env.contacts = [];

// Calculate the results pane position and size
var pos = $(this.ksearch_input).offset();
// Elastic: On small screen we use the width/position of the whole .ac-input element (input's parent)
var is_composite_input = $('html').is('.layout-small,.layout-phone') && $(this.ksearch_input).parents('.ac-input').length == 1,
input = is_composite_input ? $(this.ksearch_input).parents('.ac-input')[0] : $(this.ksearch_input)[0],
pos = $(input).offset();

// ... consider scroll position
pos.left -= $(document.documentElement).scrollLeft();
Expand All @@ -5983,14 +5986,17 @@ function rcube_webmail()
}

var w = $(is_framed ? parent : window).width(),
input_width = $(input).outerWidth(),
left = w - pos.left > 200 ? pos.left : w - 200,
top = (pos.top + input.offsetHeight + 1),
width = Math.min(400, w - left);

this.ksearch_pane.css({
left: left + 'px',
top: (pos.top + this.ksearch_input.offsetHeight + 1) + 'px',
maxWidth: width + 'px',
left: (is_composite_input ? pos.left : left) + 'px',
top: top + 'px',
maxWidth: (is_composite_input ? input_width : width) + 'px',
minWidth: '200px',
width: is_composite_input ? (input_width + 'px') : 'auto',
display: 'none'
});
}
Expand Down
50 changes: 26 additions & 24 deletions skins/elastic/styles/widgets/dialogs.less
Original file line number Diff line number Diff line change
Expand Up @@ -68,25 +68,6 @@
}
}

#rcmKSearchpane {
width: auto;
height: auto;

li {
padding-right: .5rem;
}

html.layout-small &,
html.layout-phone & {
bottom: auto;
border: 1px solid @color-input-border;
}

html.layout-phone & {
max-width: 100% !important;
}
}

html.layout-small,
html.layout-phone {
.popover:not(.select-menu) {
Expand Down Expand Up @@ -166,15 +147,36 @@ html.touch .popover {
.select-menu {
max-width: initial;
margin: 0;

.listing li a {
padding-left: .25rem;
outline: 0; // for Android browser
}
height: auto;

.popover-header {
border-radius: .25rem .25rem 0 0 !important;
}

.listing li {
a {
padding-left: .25rem;
outline: 0; // for Android browser
}

&:last-child {
border-bottom-right-radius: .25rem;
border-bottom-left-radius: .25rem;
}
}

// Use 'inline' class for menus that have a list elements with no <a> inside
// and no header
&.inline {
.listing li {
padding-right: .5rem;

&:first-child {
border-top-left-radius: .25rem;
border-top-right-radius: .25rem;
}
}
}
}

/** PGP Key search/import dialog **/
Expand Down
2 changes: 1 addition & 1 deletion skins/elastic/ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -3182,7 +3182,7 @@ function rcube_elastic_ui()
.on('blur', function() { list.removeClass('focus'); })
.on('focus mousedown', function() { list.addClass('focus'); });

list = $('<ul>').addClass('form-control recipient-input')
list = $('<ul>').addClass('form-control recipient-input ac-input')
.append($('<li>').append(input))
.on('click', function() { input.focus(); });

Expand Down

0 comments on commit ed085db

Please sign in to comment.