Browse Source

Fixes #3183, mobile sub-menus will not select

pull/3704/head
Jack Lukic 8 years ago
parent
commit
dbf9968aed
2 changed files with 24 additions and 9 deletions
  1. 12
      RELEASE-NOTES.md
  2. 21
      src/definitions/modules/dropdown.js

12
RELEASE-NOTES.md

@ -1,5 +1,17 @@
## RELEASE NOTES ## RELEASE NOTES
### Version 2.1.9 - Feb 15, 2016
**Bugs**
-**Dropdown** - Fixed issue where dropdowns with sub-menus would not properly activate on mobile #3183
-**API** - Fixes bug where `beforeSend` would not correctly cancel request when `return false;` is used in callback. #3660
**Enhancements**
### Version 2.1.8 - Jan 7, 2016 ### Version 2.1.8 - Jan 7, 2016
**Critical Fix** **Critical Fix**

21
src/definitions/modules/dropdown.js

@ -324,8 +324,8 @@ $.fn.dropdown = function(parameters) {
module.set.multiple(); module.set.multiple();
} }
if ($input.prop('disabled')) { if ($input.prop('disabled')) {
module.debug('Disabling dropdown')
$module.addClass(className.disabled)
module.debug('Disabling dropdown');
$module.addClass(className.disabled);
} }
$input $input
.removeAttr('class') .removeAttr('class')
@ -970,17 +970,20 @@ $.fn.dropdown = function(parameters) {
item: { item: {
mouseenter: function(event) { mouseenter: function(event) {
var var
$subMenu = $(this).children(selector.menu),
$otherMenus = $(this).siblings(selector.item).children(selector.menu)
$target = $(event.target),
$subMenu = $(this).children(selector.menu),
$otherMenus = $(this).siblings(selector.item).children(selector.menu),
hasSubMenu = ($subMenu.length > 0),
isBubbledEvent = ($subMenu.find($target).length > 0)
; ;
if( $subMenu.length > 0 ) {
if( !isBubbledEvent && hasSubMenu ) {
clearTimeout(module.itemTimer); clearTimeout(module.itemTimer);
module.itemTimer = setTimeout(function() { module.itemTimer = setTimeout(function() {
module.verbose('Showing sub-menu', $subMenu); module.verbose('Showing sub-menu', $subMenu);
$.each($otherMenus, function() { $.each($otherMenus, function() {
module.animate.hide(false, $(this)); module.animate.hide(false, $(this));
}); });
module.animate.show(false, $subMenu);
module.animate.show(false, $subMenu);
}, settings.delay.show); }, settings.delay.show);
event.preventDefault(); event.preventDefault();
} }
@ -993,7 +996,7 @@ $.fn.dropdown = function(parameters) {
clearTimeout(module.itemTimer); clearTimeout(module.itemTimer);
module.itemTimer = setTimeout(function() { module.itemTimer = setTimeout(function() {
module.verbose('Hiding sub-menu', $subMenu); module.verbose('Hiding sub-menu', $subMenu);
module.animate.hide(false, $subMenu);
module.animate.hide(false, $subMenu);
}, settings.delay.hide); }, settings.delay.hide);
} }
}, },
@ -1189,7 +1192,7 @@ $.fn.dropdown = function(parameters) {
if(isSubMenuItem) { if(isSubMenuItem) {
module.verbose('Left key pressed, closing sub-menu'); module.verbose('Left key pressed, closing sub-menu');
module.animate.hide(false, $parentMenu);
module.animate.hide(false, $parentMenu);
$selectedItem $selectedItem
.removeClass(className.selected) .removeClass(className.selected)
; ;
@ -1205,7 +1208,7 @@ $.fn.dropdown = function(parameters) {
if(pressedKey == keys.rightArrow) { if(pressedKey == keys.rightArrow) {
if(hasSubMenu) { if(hasSubMenu) {
module.verbose('Right key pressed, opening sub-menu'); module.verbose('Right key pressed, opening sub-menu');
module.animate.show(false, $subMenu);
module.animate.show(false, $subMenu);
$selectedItem $selectedItem
.removeClass(className.selected) .removeClass(className.selected)
; ;

Loading…
Cancel
Save