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
336 window.open value.href or value, '_blank'336 window.open value.href or value, '_blank'
337 return337 return
338 338
339isMac = null
339$.isMac = ->340$.isMac = ->
340 navigator.userAgent?.indexOf('Mac') >= 0341 isMac ?= navigator.userAgent?.indexOf('Mac') >= 0
341 342
343isIE = null
342$.isIE = ->344$.isIE = ->
343 navigator.userAgent?.indexOf('MSIE') >= 0 || navigator.userAgent?.indexOf('rv:11.0') >= 0345 isIE ?= navigator.userAgent?.indexOf('MSIE') >= 0 || navigator.userAgent?.indexOf('rv:11.0') >= 0
346
347isAndroid = null
348$.isAndroid = ->
349 isAndroid ?= navigator.userAgent?.indexOf('Android') >= 0
350
351isIOS = null
352$.isIOS = ->
353 isIOS ?= navigator.userAgent?.indexOf('iPhone') >= 0 || navigator.userAgent?.indexOf('iPad') >= 0
344 354
345HIGHLIGHT_DEFAULTS =355HIGHLIGHT_DEFAULTS =
346 className: 'highlight'356 className: 'highlight'
assets/javascripts/views/search/search.coffee+1−1
@@ -41,7 +41,7 @@ class app.views.Search extends app.View · 40 unmodified lines
41 return41 return
42 42
43 autoFocus: =>43 autoFocus: =>
44 unless app.isMobile()44 unless app.isMobile() or $.isAndroid() or $.isIOS()
45 @input.focus() unless document.activeElement is @input45 @input.focus() unless document.activeElement is @input
46 return46 return
47 47