History

Focus the search field when typing '/' or alphanumeric characters on mobile

Thibaut Courouble committed 9 years ago

Commit 9adf4e21 parent 48d85f11 file · +3 −4Browse files

Unified · Split

assets/javascripts/views/search/search.coffee+3−4
@@ -14,7 +14,7 @@ class app.views.Search extends app.View · 13 unmodified lines
14 submit: 'onSubmit'14 submit: 'onSubmit'
15 15
16 @shortcuts:16 @shortcuts:
17 typing: 'autoFocus'17 typing: 'focus'
18 altG: 'google'18 altG: 'google'
19 altS: 'stackoverflow'19 altS: 'stackoverflow'
20 20
@@ -34,9 +34,8 @@ class app.views.Search extends app.View · 13 unmodified lines
34 $.on window, 'focus', @autoFocus34 $.on window, 'focus', @autoFocus
35 return35 return
36 36
37 focus: ->37 focus: =>
38 @delay =>38 @input.focus() unless document.activeElement is @input
39 @input.focus() unless document.activeElement is @input
40 return39 return
41 40
42 autoFocus: =>41 autoFocus: =>