Disable up/down buttons in the scrollable menu (language menu).

This commit is contained in:
Julia Radzhabova 2017-09-19 12:03:15 +03:00
parent 40cc71ea63
commit a76214961d
2 changed files with 20 additions and 6 deletions

View file

@ -468,14 +468,20 @@ define([
}, },
onScroll: function(item, e) { onScroll: function(item, e) {
if (this.fromKeyDown) { if (this.scroller) return;
var menuRoot = (this.cmpEl.attr('role') === 'menu') var menuRoot = (this.cmpEl.attr('role') === 'menu')
? this.cmpEl ? this.cmpEl
: this.cmpEl.find('[role=menu]'); : this.cmpEl.find('[role=menu]'),
scrollTop = menuRoot.scrollTop(),
menuRoot.find('.menu-scroll.top').css('top', menuRoot.scrollTop() + 'px'); top = menuRoot.find('.menu-scroll.top'),
menuRoot.find('.menu-scroll.bottom').css('bottom', (-menuRoot.scrollTop()) + 'px'); bottom = menuRoot.find('.menu-scroll.bottom');
if (this.fromKeyDown) {
top.css('top', scrollTop + 'px');
bottom.css('bottom', (-scrollTop) + 'px');
} }
top.toggleClass('disabled', scrollTop<1);
bottom.toggleClass('disabled', scrollTop + this.options.maxHeight > menuRoot[0].scrollHeight-1);
}, },
onItemClick: function(item, e) { onItemClick: function(item, e) {
@ -496,6 +502,8 @@ define([
}, },
onScrollClick: function(e) { onScrollClick: function(e) {
if (/disabled/.test(e.currentTarget.className)) return false;
this.scrollMenu(/top/.test(e.currentTarget.className)); this.scrollMenu(/top/.test(e.currentTarget.className));
return false; return false;
}, },

View file

@ -66,6 +66,7 @@
background-color: @dropdown-bg; background-color: @dropdown-bg;
height: 16px; height: 16px;
width: 100%; width: 100%;
cursor: pointer;
&.top { &.top {
top: 0; top: 0;
@ -96,5 +97,10 @@
border-left: 3px solid transparent; border-left: 3px solid transparent;
} }
} }
&.disabled {
opacity: 0.3;
cursor: default;
}
} }
} }