Unified · Split
| @@ -31,7 +31,7 @@ class app.views.Search extends app.View · 30 unmodified lines | ||
| 31 | 31 | |
| 32 | 32 | app.on 'ready', @onReady |
| 33 | 33 | $.on window, 'hashchange', @searchUrl |
| 34 | − $.on window, 'focus', @autoFocus | |
| 34 | + $.on window, 'focus', @onWindowFocus | |
| 35 | 35 | return |
| 36 | 36 | |
| 37 | 37 | focus: => |
| @@ -43,6 +43,9 @@ class app.views.Search extends app.View · 5 unmodified lines | ||
| 43 | 43 | @input.focus() unless document.activeElement?.tagName is 'INPUT' |
| 44 | 44 | return |
| 45 | 45 | |
| 46 | + onWindowFocus: (event) => | |
| 47 | + @autoFocus() if event.target is window | |
| 48 | + | |
| 46 | 49 | getScopeDoc: -> |
| 47 | 50 | @scope.getScope() if @scope.isActive() |
| 48 | 51 | |
| @@ -135,7 +138,7 @@ class app.views.Search extends app.View · 86 unmodified lines | ||
| 135 | 138 | return if app.shortcuts.eventInProgress?.name is 'escape' |
| 136 | 139 | @reset(true) if not context.init and app.router.isIndex() |
| 137 | 140 | @delay @searchUrl if context.hash |
| 138 | − @delay @autoFocus | |
| 141 | + $.requestAnimationFrame @autoFocus | |
| 139 | 142 | return |
| 140 | 143 | |
| 141 | 144 | extractHashValue: -> |