From 9c69cb3685196834d2da30c9a297246f1245e2f8 Mon Sep 17 00:00:00 2001 From: Jack Lukic Date: Sun, 6 Mar 2016 23:00:32 -0500 Subject: [PATCH] Add cursor spacing, fix #3790 issue with search losing focus on selection --- RELEASE-NOTES.md | 3 ++- src/definitions/modules/dropdown.js | 9 +++++++-- src/definitions/modules/dropdown.less | 1 + src/themes/default/modules/dropdown.variables | 3 ++- 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index 3f6da20bf..26e60c12c 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -28,7 +28,7 @@ - **Dropdown** - Dropdown would open when an label delete x was clicked when not using `search selection` #3789 - **Dropdown** - Dropdowns with sub-menus would not properly activate on mobile #3183 - **Dropdown** - Long dropdown text entry with `allowAdditions` would cause input to mistakingly drop to next line early #3743 -- **Dropdown** - Multi select would lose search input focus when clicking on a choice +- **Dropdown** - Seach selection would lose search input focus when clicking on a choice #3790 - **Form** - Grouped `fields` and `field` would cause different margin collapse, making `fields` include larger gaps between content #3717 - **Form** - Remove deprecated `size()` method in `prompt` #3655 **Thanks @SimonArdrey** - **Grid** - `centered` content would cause `justified` content to appear aligned left. #3496 @@ -47,6 +47,7 @@ - **Table** - `striped selectable` table would not correctly show hover color on striped rows **Enhancements** +- **Dropdown** - Added `1px` offset for current text so that the text position cursor does not overlap first pixel of text. - **Dropdown** - Added new convenience method `restore placeholder text` - **Rating** - Added new setting `fireOnInit` for rating, which defaults to `false`. When set to true `onRate` will fire when rating is initialized #3712 - **Site** `@px` and `@relativepx` i.e. `@relative12px` which can be used to return EM value of pixels are now extended to `@relative40px` diff --git a/src/definitions/modules/dropdown.js b/src/definitions/modules/dropdown.js index 8fa5d4ec3..cbd04499d 100644 --- a/src/definitions/modules/dropdown.js +++ b/src/definitions/modules/dropdown.js @@ -827,8 +827,13 @@ $.fn.dropdown = function(parameters) { $target = $(event.target) ; // focus search - if($target.is($module) && !module.is.focusedOnSearch()) { - module.focusSearch(); + if($target.is($module)) { + if(!module.is.focusedOnSearch()) { + module.focusSearch(); + } + else { + module.show(); + } } }, blur: function(event) { diff --git a/src/definitions/modules/dropdown.less b/src/definitions/modules/dropdown.less index abcec9b7e..b90bc57c5 100755 --- a/src/definitions/modules/dropdown.less +++ b/src/definitions/modules/dropdown.less @@ -548,6 +548,7 @@ select.ui.dropdown { .ui.search.dropdown > .text { cursor: text; position: relative; + left: @textCursorSpacing; z-index: 3; } diff --git a/src/themes/default/modules/dropdown.variables b/src/themes/default/modules/dropdown.variables index 0a1e1ff2a..f0c848572 100644 --- a/src/themes/default/modules/dropdown.variables +++ b/src/themes/default/modules/dropdown.variables @@ -44,6 +44,7 @@ /* Text */ @textLineHeight: 1em; @textLineHeightOffset: (@textLineHeight - 1em); +@textCursorSpacing: 1px; /* Menu Item */ @itemFontSize: @medium; @@ -367,4 +368,4 @@ /* Pointing Upward */ @pointingUpwardMenuBorderRadius: @borderRadius; -@pointingUpwardArrowBoxShadow: @menuBorderWidth @menuBorderWidth 0px @menuBorderWidth @menuBorderColor; \ No newline at end of file +@pointingUpwardArrowBoxShadow: @menuBorderWidth @menuBorderWidth 0px @menuBorderWidth @menuBorderColor;