Fixed bug: .focus() on searchable select won't focus visible input field.

This commit is contained in:
Thorsten Eckel 2017-09-13 12:35:58 +02:00
parent 18d4074329
commit 7592843a5c

View file

@ -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