Skip to content

Commit 484598e

Browse files
authored
Merge pull request #282 from canjs/273-dont-autofocus-search
Don't auto focus input and fix tab indices. fixes #273
2 parents 9784ab3 + 0c3d1f8 commit 484598e

File tree

2 files changed

+8
-27
lines changed

2 files changed

+8
-27
lines changed

static/search.js

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -88,12 +88,6 @@ var Search = Control.extend({
8888
self.$inputWrap.show();
8989
}
9090

91-
//focus the search on init
92-
//only do stuff if we have an input to work with
93-
if(self.$input && self.$input.length){
94-
self.$input.trigger("focus");
95-
}
96-
9791
self.bindResultsEvents();
9892
}, function(error){
9993
console.error("getSearchMap error", error);
@@ -483,26 +477,6 @@ var Search = Control.extend({
483477
},
484478
// ---- END RESULTS EVENTS ---- //
485479

486-
487-
// ---- WINDOW EVENTS ---- //
488-
489-
// [ctrl + k] focuses the search input
490-
"{window} keyup": function(el, ev){
491-
if(!ev.ctrlKey){
492-
return true;
493-
}
494-
495-
switch(ev.keyCode){
496-
case 75: // 'k'
497-
this.$input.trigger("focus");
498-
break;
499-
}
500-
},
501-
502-
// ---- END WINDOW EVENTS ---- //
503-
504-
505-
506480
// ---- SEARCH VIEW ---- //
507481

508482
// function search

templates/search-bar.mustache

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@
22
<div class="search-wrap" style="display:none;">
33
<span class="search-icon"></span>
44
<span class="search-icon-cancel"></span>
5-
<input type="text" class="search" placeholder="Search - [ctrl + k]" autocomplete="off" autocorrect="off" autocapitalize="none" spellcheck="false" />
5+
<input
6+
type="text"
7+
class="search"
8+
placeholder="Search"
9+
autocomplete="off"
10+
autocorrect="off"
11+
autocapitalize="none"
12+
spellcheck="false"/>
613
</div>
714
</div>

0 commit comments

Comments
 (0)