mirror of
https://github.com/atom/atom.git
synced 2026-04-06 03:02:13 -04:00
Scroll to top when selecting first element
This ensures that the top path is always visible when the first operation is selected.
This commit is contained in:
@@ -402,7 +402,8 @@ describe "CommandPanel", ->
|
||||
|
||||
expect(previewList.scrollBottom()).toBeCloseTo previewList.prop('scrollHeight'), -1
|
||||
|
||||
_.times previewList.getOperations().length, -> previewList.trigger 'core:move-up'
|
||||
previewList.trigger 'core:move-down'
|
||||
expect(previewList.scrollTop()).toBe 0
|
||||
|
||||
it "wraps around when the list is at the beginning or end", ->
|
||||
rootView.attachToDom()
|
||||
|
||||
@@ -73,7 +73,10 @@ class PreviewList extends ScrollView
|
||||
@children(".selected").removeClass('selected')
|
||||
element = @children("li.operation:eq(#{index})")
|
||||
element.addClass('selected')
|
||||
@scrollToElement(element)
|
||||
if index is 0
|
||||
@scrollToTop()
|
||||
else
|
||||
@scrollToElement(element)
|
||||
@selectedOperationIndex = index
|
||||
|
||||
executeSelectedOperation: ->
|
||||
|
||||
Reference in New Issue
Block a user