This repository was archived by the owner on Apr 12, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +16
-6
lines changed
Expand file tree Collapse file tree 2 files changed +16
-6
lines changed Original file line number Diff line number Diff line change 198198 autocomplete ="off " />
199199 </ form >
200200 < div ng-show ="hasResults " class ="search-results ">
201- < a href ="" ng-click ="hideResults() " class ="search-close ">
202- < span class ="icon-remove-sign "> </ span >
203- </ a >
204201 < div ng-repeat ="(key, value) in results " class ="search-group " ng-class ="colClassName ">
205202 < h4 > {{ key }}</ h4 >
206203 < div ng-repeat ="item in value " class ="search-result ">
207204 < a ng-click ="hideResults() " href ="{{ item.url }} "> {{ item.shortName }}</ a >
208205 </ div >
209206 </ div >
207+ < a href ="" ng-click ="hideResults() " class ="search-close ">
208+ < span class ="icon-remove-sign "> </ span >
209+ </ a >
210210 </ div >
211211 </ div >
212212 </ div >
Original file line number Diff line number Diff line change @@ -132,9 +132,19 @@ docsApp.directive.focused = function($timeout) {
132132 } ;
133133} ;
134134
135- docsApp . directive . docsSearchInput = function ( ) {
135+ docsApp . directive . docsSearchInput = [ '$document' , function ( $document ) {
136136 return function ( scope , element , attrs ) {
137- var ESCAPE_KEY_KEYCODE = 27 ;
137+ var ESCAPE_KEY_KEYCODE = 27 ,
138+ FORWARD_SLASH_KEYCODE = 191 ;
139+ angular . element ( $document [ 0 ] . body ) . bind ( 'keydown' , function ( event ) {
140+ var input = element [ 0 ] ;
141+ if ( event . keyCode == FORWARD_SLASH_KEYCODE && document . activeElement != input ) {
142+ event . stopPropagation ( ) ;
143+ event . preventDefault ( ) ;
144+ input . focus ( ) ;
145+ }
146+ } ) ;
147+
138148 element . bind ( 'keydown' , function ( event ) {
139149 if ( event . keyCode == ESCAPE_KEY_KEYCODE ) {
140150 event . stopPropagation ( ) ;
@@ -145,7 +155,7 @@ docsApp.directive.docsSearchInput = function() {
145155 }
146156 } ) ;
147157 } ;
148- } ;
158+ } ] ;
149159
150160
151161docsApp . directive . code = function ( ) {
You can’t perform that action at this time.
0 commit comments