assets/javascripts/semantic_ui/definitions/modules/dropdown.js in less-rails-semantic_ui-2.2.9.0 vs assets/javascripts/semantic_ui/definitions/modules/dropdown.js in less-rails-semantic_ui-2.2.10.0
- old
+ new
@@ -973,11 +973,11 @@
module.search();
}
},
blur: function(event) {
pageLostFocus = (document.activeElement === this);
- if(!willRefocus) {
+ if(module.is.searchSelection() && !willRefocus) {
if(!itemActivated && !pageLostFocus) {
if(settings.forceSelection) {
module.forceSelection();
}
module.hide();
@@ -1156,10 +1156,14 @@
text = module.get.choiceText($choice),
value = module.get.choiceValue($choice, text),
hasSubMenu = ($subMenu.length > 0),
isBubbledEvent = ($subMenu.find($target).length > 0)
;
+ // prevents IE11 bug where menu receives focus even though `tabindex=-1`
+ if(module.has.menuSearch()) {
+ $(document.activeElement).blur();
+ }
if(!isBubbledEvent && (!hasSubMenu || settings.allowCategorySelection)) {
if(module.is.searchSelection()) {
if(settings.allowAdditions) {
module.remove.userAddition();
}
@@ -3067,10 +3071,13 @@
menu : {
offset: $currentMenu.offset(),
height: $currentMenu.outerHeight()
}
};
+ if(module.is.verticallyScrollableContext()) {
+ calculations.menu.offset.top += calculations.context.scrollTop;
+ }
onScreen = {
above : (calculations.context.scrollTop) <= calculations.menu.offset.top - calculations.menu.height,
below : (calculations.context.scrollTop + calculations.context.height) >= calculations.menu.offset.top + calculations.menu.height
};
if(onScreen.below) {
@@ -3140,9 +3147,17 @@
visible: function($subMenu) {
return ($subMenu)
? $subMenu.hasClass(className.visible)
: $menu.hasClass(className.visible)
;
+ },
+ verticallyScrollableContext: function() {
+ var
+ overflowY = ($context.get(0) !== window)
+ ? $context.css('overflow-y')
+ : false
+ ;
+ return (overflowY == 'auto' || overflowY == 'scroll');
}
},
can: {
activate: function($item) {