Handle TextEditorElement::focus() while parent is being attached

Fixes atom/autocomplete#61
This commit is contained in:
Max Brunsfeld
2015-01-09 15:00:29 -08:00
parent 19bf64f3cd
commit f9bde050b4
2 changed files with 19 additions and 5 deletions

View File

@@ -63,7 +63,8 @@ class TextEditorElement extends HTMLElement
@buildModel() unless @getModel()?
@mountComponent() unless @component?.isMounted()
@component.checkForVisibilityChange()
@focus() if @focusOnAttach
if this is document.activeElement
@focused()
@emitter.emit("did-attach")
detachedCallback: ->
@@ -128,10 +129,7 @@ class TextEditorElement extends HTMLElement
@component = null
focused: ->
if @component?
@component.focused()
else
@focusOnAttach = true
@component?.focused()
blurred: (event) ->
unless @useShadowDOM