From 33ea63ec9139ffd3cc49ae492aeffd1666f8db63 Mon Sep 17 00:00:00 2001 From: Jack Lukic Date: Sun, 31 Jul 2016 17:38:38 -0400 Subject: [PATCH] Fix dropdown icon spacing, fix issues with selectOnKeydown when using text that includes html (like images) --- RELEASE-NOTES.md | 3 +++ src/definitions/elements/button.less | 4 ++-- src/definitions/modules/dropdown.js | 11 ++++++++--- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index 427c3dcd4..ea3e6f1a3 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -4,11 +4,14 @@ **Enhancements** - **Form Validation** - Bracketed notation can now be omitted for rules, instead passing in bracketed values with the `value` parameter #3313 +- **Dropdown** - Using `search selection` with `selectOnKeydown` will now highlight the partial search matching the currently keyboard selected value **Bugs** +- **Button/Dropdown** - Fixed issue where `ui dropdown button` could have incorrect spacing for dropdown icon - **Button** - Fixed `vertical buttons` with only 1 button having incorrect border radius **Thanks @Denhai** #4107 - **Form** - Fixed issue where `disabled fields` with radio inputs would not correctly dim the label **Thanks @louwers** #4366 - **Menu** - Fixed issue where `dropdown` in `vertical menu` would not correctly open `upward` when no space below **Thanks @gdaunton** #4150 #4156 +- **Dropdown** - Using `search selection with `selectOnKeydown` and text content that includes html, will not apply html content (like images) to the text until dropdown blur, making sure that content can align correctly with the partial search content of the search input (which cannot include HTML) - **Dropdown** - Fixed issue where dropdown `clear` would not remove active state when `useLabels: true` and multiple dropdown #4275 #4366 **Thanks vinh123456789** - **Dropdown** - `dropdown icon` no longer relies on stopping event propagation. This means using the dropdown icon will now cause other dropdowns to correctly hide. #3998 - **Dropdown** - Fixes `action: select` not working correctly since `2.2` due to incorrect use of new function signature. #4183 diff --git a/src/definitions/elements/button.less b/src/definitions/elements/button.less index ff1fd160c..9e6506640 100755 --- a/src/definitions/elements/button.less +++ b/src/definitions/elements/button.less @@ -591,10 +591,10 @@ color: @iconColor; } -.ui.button:not(.icon) > .icon:not(.button) { +.ui.button:not(.icon) > .icon:not(.button):not(.dropdown) { margin: @iconMargin; } -.ui.button:not(.icon) > .right.icon:not(.button) { +.ui.button:not(.icon) > .right.icon:not(.button):not(.dropdown) { margin: @rightIconMargin; } diff --git a/src/definitions/modules/dropdown.js b/src/definitions/modules/dropdown.js index fc5351bfc..0ae40b02b 100644 --- a/src/definitions/modules/dropdown.js +++ b/src/definitions/modules/dropdown.js @@ -958,7 +958,7 @@ $.fn.dropdown = function(parameters) { pageLostFocus = (document.activeElement === this); if(!willRefocus) { if(!itemActivated && !pageLostFocus) { - if(settings.forceSelection && module.has.query()) { + if(settings.forceSelection) { module.forceSelection(); } module.hide(); @@ -2294,11 +2294,16 @@ $.fn.dropdown = function(parameters) { } }, selectedItem: function($item) { + var + value = module.get.choiceValue($item), + text = module.get.choiceText($item, false) + ; module.debug('Setting user selection to item', $item); module.remove.activeItem(); - module.set.partialSearch(module.get.choiceText($item)); + module.set.partialSearch(text); module.set.activeItem($item); - module.set.selected(module.get.choiceValue($item), $item); + module.set.selected(value, $item); + module.set.text(text); }, selectedLetter: function(letter) { var