History

Don't autofocus search input on Android/iOS

Thibaut Courouble committed 9 years ago

Commit 63bb8cd1 parent 6cd27c22 files · +13 −3Browse files

Unified · Split

2 files
  1. assets/javascripts/lib/util.coffee +12 −2
  2. assets/javascripts/views/search/search.coffee +1 −1
assets/javascripts/lib/util.coffee+12−2
@@ -336,11 +336,21 @@ $.popup = (value) -> · 335 unmodified lines
336336 window.open value.href or value, '_blank'
337337 return
338338
339+isMac = null
339340 $.isMac = ->
340− navigator.userAgent?.indexOf('Mac') >= 0
341+ isMac ?= navigator.userAgent?.indexOf('Mac') >= 0
341342
343+isIE = null
342344 $.isIE = ->
343− navigator.userAgent?.indexOf('MSIE') >= 0 || navigator.userAgent?.indexOf('rv:11.0') >= 0
345+ isIE ?= navigator.userAgent?.indexOf('MSIE') >= 0 || navigator.userAgent?.indexOf('rv:11.0') >= 0
346+
347+isAndroid = null
348+$.isAndroid = ->
349+ isAndroid ?= navigator.userAgent?.indexOf('Android') >= 0
350+
351+isIOS = null
352+$.isIOS = ->
353+ isIOS ?= navigator.userAgent?.indexOf('iPhone') >= 0 || navigator.userAgent?.indexOf('iPad') >= 0
344354
345355 HIGHLIGHT_DEFAULTS =
346356 className: 'highlight'
assets/javascripts/views/search/search.coffee+1−1
@@ -41,7 +41,7 @@ class app.views.Search extends app.View · 40 unmodified lines
4141 return
4242
4343 autoFocus: =>
44− unless app.isMobile()
44+ unless app.isMobile() or $.isAndroid() or $.isIOS()
4545 @input.focus() unless document.activeElement is @input
4646 return
4747