From b5cc90267d9b6634bb26c4c5df1b38994d603f4b Mon Sep 17 00:00:00 2001 From: cbryer Date: Wed, 29 Jul 2015 13:21:33 -0400 Subject: [PATCH 1/3] fix(searchEnabled): maintain keyboard nagivation Fix issue where keyboard navigation was disabled when searchEnabled was set to false. Caused by hiding the input box which prevent key events from propagating to the directive. Resolved hiding the input offscreen when searchEnabled is false. Fixes #1059, fixes #917, fixes #589, fixes #375 Closes #1543, closes #1114, closes #1109 (supersedes all) --- src/bootstrap/select.tpl.html | 3 ++- src/common.css | 29 ++++++++++++++++++++++++++++- src/select2/select.tpl.html | 2 +- src/selectize/select.tpl.html | 3 ++- src/uiSelectController.js | 4 ++++ test/select.spec.js | 12 ++++++------ 6 files changed, 43 insertions(+), 10 deletions(-) diff --git a/src/bootstrap/select.tpl.html b/src/bootstrap/select.tpl.html index 293e51a51..bed1e4d77 100644 --- a/src/bootstrap/select.tpl.html +++ b/src/bootstrap/select.tpl.html @@ -6,9 +6,10 @@ aria-owns="ui-select-choices-{{ $select.generatedId }}" aria-activedescendant="ui-select-choices-row-{{ $select.generatedId }}-{{ $select.activeIndex }}" class="form-control ui-select-search" + ng-class="{ 'ui-select-search-hidden' : !$select.searchEnabled }" placeholder="{{$select.placeholder}}" ng-model="$select.search" - ng-show="$select.searchEnabled && $select.open"> + ng-show="$select.open">
diff --git a/src/common.css b/src/common.css index 0a843ea18..580c42d4a 100644 --- a/src/common.css +++ b/src/common.css @@ -74,6 +74,16 @@ body > .select2-container.open { border-bottom-color: #5897fb; } +.ui-select-container[theme="select2"] .ui-select-dropdown .ui-select-search-hidden, +.ui-select-container[theme="select2"] .ui-select-dropdown .ui-select-search-hidden input{ + opacity: 0; + height: 0; + min-height: 0; + padding: 0; + margin: 0; + border:0; +} + /* Selectize theme */ /* Helper class to show styles when focus */ @@ -99,10 +109,18 @@ body > .select2-container.open { /* Handle up direction Selectize */ .ui-select-container[theme="selectize"].direction-up .ui-select-dropdown { box-shadow: 0 -4px 8px rgba(0, 0, 0, 0.25); - margin-top: -2px; /* FIXME hardcoded value :-/ */ } +.ui-select-container[theme="selectize"] .ui-select-search-hidden{ + opacity: 0; + height: 0; + min-height: 0; + padding: 0; + margin: 0; + border:0; +} + /* Bootstrap theme */ /* Helper class to show styles when focus */ @@ -145,6 +163,15 @@ body > .select2-container.open { border-bottom-right-radius: 0 !important; } +.ui-select-bootstrap .ui-select-search-hidden{ + opacity: 0; + height: 0; + min-height: 0; + padding: 0; + margin: 0; + border:0; +} + .ui-select-bootstrap > .ui-select-match > .btn{ /* Instead of center because of .btn */ text-align: left !important; diff --git a/src/select2/select.tpl.html b/src/select2/select.tpl.html index 7b905a63f..60629c9b0 100644 --- a/src/select2/select.tpl.html +++ b/src/select2/select.tpl.html @@ -6,7 +6,7 @@