From 9006d4cb4e6c8656346ffc774c48de5ce86b05e7 Mon Sep 17 00:00:00 2001 From: Jack Lukic Date: Thu, 29 Dec 2016 14:50:32 -0500 Subject: [PATCH] Fixes #4490 - Dropdown with search inside menu should be tabbable. Fixes issue with selectOnKeydown and html text --- RELEASE-NOTES.md | 3 +++ src/definitions/modules/dropdown.js | 22 ++++++++++++++++------ 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index e23bc52947..234344410c 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -15,13 +15,16 @@ **Critical Bugs** - **Dropdown/Search/Checkbox** - Removes use of deprecated - **Dropdown** - `forceSelection` will no longer select value in `multiple selection dropdown` #4041 #4516 +- **Dropdown** - Fix issue where `dropdown` with `search` in menu are not tabbable #4490 - **Search** - Fixes issue where search will re-appear with incorrect results when using `show `showNoResults: false` to hide no results messages. #4616 + **Bugs** - **Button** - Fixed issue where css specificity caused `icon buttons` to not center correctly #4487 - **Dropdown** - Fixed bug where clicking `dropdown icon` using remote data would cause nothing to happen #4041 - **Dropdown** - Fix bug where `scrolling menu` or `scrolling dropdown` would have excessive right padding by removing scrollbar width from calculation (no longer necessary in modern browsers) - **Comments** - `small`, `large` and other comment sizes now default to global size variables. +- **Dropdown** - Fixed issue where `selectOnKeydown` with `html` content would cause only non html content to display in `text` until blur **Documentation** - **Visibility** - Added documentation for `onOnscreen` and `onOffScreen` to important callbacks somehow omitted from docs diff --git a/src/definitions/modules/dropdown.js b/src/definitions/modules/dropdown.js index 446a06c75a..9dff5aee7f 100644 --- a/src/definitions/modules/dropdown.js +++ b/src/definitions/modules/dropdown.js @@ -621,8 +621,17 @@ $.fn.dropdown = function(parameters) { .on('mousedown' + eventNamespace, module.event.mousedown) .on('mouseup' + eventNamespace, module.event.mouseup) .on('focus' + eventNamespace, module.event.focus) - .on('blur' + eventNamespace, module.event.blur) ; + if(module.has.menuSearch() ) { + $module + .on('blur' + eventNamespace, selector.search, module.event.search.blur) + ; + } + else { + $module + .on('blur' + eventNamespace, module.event.blur) + ; + } } $menu .on('mouseenter' + eventNamespace, selector.item, module.event.item.mouseenter) @@ -2190,7 +2199,7 @@ $.fn.dropdown = function(parameters) { $text.addClass(className.placeholder); }, tabbable: function() { - if( module.has.search() ) { + if( module.is.searchSelection() ) { module.debug('Added tabindex to searchable dropdown'); $search .val('') @@ -2302,12 +2311,13 @@ $.fn.dropdown = function(parameters) { }, selectedItem: function($item) { var - value = module.get.choiceValue($item), - text = module.get.choiceText($item, false) + value = module.get.choiceValue($item), + searchText = module.get.choiceText($item, false), + text = module.get.choiceText($item, true) ; module.debug('Setting user selection to item', $item); module.remove.activeItem(); - module.set.partialSearch(text); + module.set.partialSearch(searchText); module.set.activeItem($item); module.set.selected(value, $item); module.set.text(text); @@ -2896,7 +2906,7 @@ $.fn.dropdown = function(parameters) { ; }, tabbable: function() { - if( module.has.search() ) { + if( module.is.searchSelection() ) { module.debug('Searchable dropdown initialized'); $search .removeAttr('tabindex')