This repository was archived by the owner on Apr 12, 2024. It is now read-only.
File tree 2 files changed +16
-6
lines changed
2 files changed +16
-6
lines changed Original file line number Diff line number Diff line change 198
198
autocomplete ="off " />
199
199
</ form >
200
200
< 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 >
204
201
< div ng-repeat ="(key, value) in results " class ="search-group " ng-class ="colClassName ">
205
202
< h4 > {{ key }}</ h4 >
206
203
< div ng-repeat ="item in value " class ="search-result ">
207
204
< a ng-click ="hideResults() " href ="{{ item.url }} "> {{ item.shortName }}</ a >
208
205
</ div >
209
206
</ div >
207
+ < a href ="" ng-click ="hideResults() " class ="search-close ">
208
+ < span class ="icon-remove-sign "> </ span >
209
+ </ a >
210
210
</ div >
211
211
</ div >
212
212
</ div >
Original file line number Diff line number Diff line change @@ -132,9 +132,19 @@ docsApp.directive.focused = function($timeout) {
132
132
} ;
133
133
} ;
134
134
135
- docsApp . directive . docsSearchInput = function ( ) {
135
+ docsApp . directive . docsSearchInput = [ '$document' , function ( $document ) {
136
136
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
+
138
148
element . bind ( 'keydown' , function ( event ) {
139
149
if ( event . keyCode == ESCAPE_KEY_KEYCODE ) {
140
150
event . stopPropagation ( ) ;
@@ -145,7 +155,7 @@ docsApp.directive.docsSearchInput = function() {
145
155
}
146
156
} ) ;
147
157
} ;
148
- } ;
158
+ } ] ;
149
159
150
160
151
161
docsApp . directive . code = function ( ) {
You can’t perform that action at this time.
0 commit comments