Browse Source

Fixes issue with left keyboard arrow shortcut in dropdown #3596

pull/3792/head
Jack Lukic 8 years ago
parent
commit
8e485954fd
2 changed files with 32 additions and 28 deletions
  1. 1
      RELEASE-NOTES.md
  2. 59
      src/definitions/modules/dropdown.js

1
RELEASE-NOTES.md

@ -13,6 +13,7 @@
**Critical Bugs** **Critical Bugs**
- **API** - Fixed bug causing `cache: 'local'` not to return the localstorage cached results in some cases - **API** - Fixed bug causing `cache: 'local'` not to return the localstorage cached results in some cases
- **API** - Fixes bug where `beforeSend` would not correctly cancel request when `return false;` is used in callback. #3660 - **API** - Fixes bug where `beforeSend` would not correctly cancel request when `return false;` is used in callback. #3660
- **Dropdown** - Fixed bug where `search selection` would not let you move back in an entered search string with left arrow #3596
-**Form Validation / Dropdown** - Fixed issue where using "enter" key in a `search dropdown` could cause a form to be submitted #3676 -**Form Validation / Dropdown** - Fixed issue where using "enter" key in a `search dropdown` could cause a form to be submitted #3676
-**Divider** - Fixed issue where descenders like "g" would be cut off in `horizontal divider` #3585 -**Divider** - Fixed issue where descenders like "g" would be cut off in `horizontal divider` #3585

59
src/definitions/modules/dropdown.js

@ -1191,38 +1191,41 @@ $.fn.dropdown = function(parameters) {
event.preventDefault(); event.preventDefault();
} }
// left arrow (hide sub-menu)
if(pressedKey == keys.leftArrow) {
// sub-menu actions
if(hasSelectedItem) {
isSubMenuItem = ($parentMenu[0] !== $menu[0]);
if(pressedKey == keys.leftArrow) {
if(isSubMenuItem) {
module.verbose('Left key pressed, closing sub-menu');
module.animate.hide(false, $parentMenu);
$selectedItem
.removeClass(className.selected)
;
$parentMenu
.closest(selector.item)
.addClass(className.selected)
;
event.preventDefault();
isSubMenuItem = ($parentMenu[0] !== $menu[0]);
if(isSubMenuItem) {
module.verbose('Left key pressed, closing sub-menu');
module.animate.hide(false, $parentMenu);
$selectedItem
.removeClass(className.selected)
;
$parentMenu
.closest(selector.item)
.addClass(className.selected)
;
event.preventDefault();
}
} }
}
// right arrow (show sub-menu)
if(pressedKey == keys.rightArrow) {
if(hasSubMenu) {
module.verbose('Right key pressed, opening sub-menu');
module.animate.show(false, $subMenu);
$selectedItem
.removeClass(className.selected)
;
$subMenu
.find(selector.item).eq(0)
.addClass(className.selected)
;
event.preventDefault();
// right arrow (show sub-menu)
if(pressedKey == keys.rightArrow) {
if(hasSubMenu) {
module.verbose('Right key pressed, opening sub-menu');
module.animate.show(false, $subMenu);
$selectedItem
.removeClass(className.selected)
;
$subMenu
.find(selector.item).eq(0)
.addClass(className.selected)
;
event.preventDefault();
}
} }
} }

Loading…
Cancel
Save