Only call show on active item when attached

Closes atom/settings-view#258
This commit is contained in:
Kevin Sawicki
2014-10-03 15:01:23 -07:00
parent e3245ec4b8
commit a807619906

View File

@@ -4,14 +4,19 @@ PaneView = require './pane-view'
class PaneElement extends HTMLElement
createdCallback: ->
@attached = false
@subscriptions = new CompositeDisposable
@initializeContent()
@subscribeToDOMEvents()
@createSpacePenShim()
attachedCallback: ->
@attached = true
@focus() if @model.isFocused()
detachedCallback: ->
@attached = false
initializeContent: ->
@setAttribute 'class', 'pane'
@setAttribute 'tabindex', -1
@@ -52,7 +57,7 @@ class PaneElement extends HTMLElement
view = @model.getView(item).__spacePenView
otherView.hide() for otherView in $itemViews.children().not(view).views()
$itemViews.append(view) unless view.parent().is($itemViews)
view.show()
view.show() if @attached
view.focus() if @hasFocus()
itemRemoved: ({item, index, destroyed}) ->