Skip to content

Commit

Permalink
Scroll to focused item when using arrow keys
Browse files Browse the repository at this point in the history
  • Loading branch information
sandersky committed Nov 1, 2016
1 parent 96375fa commit f6062ff
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions addon/components/frost-select-dropdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,14 @@ export default Component.extend(PropTypeMixin, {

if (newFocusedIndex !== undefined && newFocusedIndex !== focusedIndex) {
this.set('focusedIndex', newFocusedIndex)

const $focusedListItem = $('.frost-select-list-item').eq(newFocusedIndex)

if (newFocusedIndex === 0) {
$('.frost-select-dropdown')[0].scrollTop = 0
} else {
$focusedListItem[0].scrollIntoView(upArrow)
}
}
},

Expand Down

0 comments on commit f6062ff

Please sign in to comment.