     @selectEntry(@roots[0])
 
     @selectEntryForPath(state.selectedPath) if state.selectedPath
-    @scrollTopAfterAttach = state.scrollTop if state.scrollTop
-    @scrollLeftAfterAttach = state.scrollLeft if state.scrollLeft
+
+    if state.scrollTop? or state.scrollLeft?
+      observer = new IntersectionObserver(=>
+        if @isVisible()
+          @element.scrollTop = state.scrollTop
+          @element.scrollLeft = state.scrollLeft
+          observer.disconnect()
+      )
+      observer.observe(@element)
+
     @element.style.width = "#{state.width}px" if state.width > 0
 
     @disposables.add @onEntryMoved ({initialPath, newPath}) ->


    @disposables = new CompositeDisposable
    @emitter = new Emitter
    @focusAfterAttach = false
    @roots = []
    @scrollLeftAfterAttach = -1
    @scrollTopAfterAttach = -1
    @selectedPath = null
    @ignoredPatterns = []
    @useSyncFS = false

  onStylesheetsChanged: =>
    # If visible, force a redraw so the scrollbars are styled correctly based on
    # the theme
    return unless @isVisible()
    @element.style.display = 'none'
    @element.offsetWidth
    @element.style.display = ''
