From 7592843a5c32d62f2cf3228a5f448a89288d4e75 Mon Sep 17 00:00:00 2001 From: Thorsten Eckel Date: Wed, 13 Sep 2017 12:35:58 +0200 Subject: [PATCH] Fixed bug: .focus() on searchable select won't focus visible input field. --- .../javascripts/app/lib/app_post/searchable_select.coffee | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/assets/javascripts/app/lib/app_post/searchable_select.coffee b/app/assets/javascripts/app/lib/app_post/searchable_select.coffee index 905e02885..d2f03df52 100644 --- a/app/assets/javascripts/app/lib/app_post/searchable_select.coffee +++ b/app/assets/javascripts/app/lib/app_post/searchable_select.coffee @@ -4,6 +4,7 @@ class App.SearchableSelect extends Spine.Controller 'input .js-input': 'onInput' 'blur .js-input': 'onBlur' 'focus .js-input': 'onFocus' + 'focus .js-shadow': 'onShadowFocus' 'click .js-option': 'selectItem' 'click .js-enter': 'navigateIn' 'click .js-back': 'navigateOut' @@ -351,6 +352,10 @@ class App.SearchableSelect extends Spine.Controller @input.prop('selectionStart', textEnd) @input.prop('selectionEnd', textEnd) + # propergate focus to our visible input + onShadowFocus: -> + @input.focus() + onInput: (event) => @toggle() if not @isOpen