Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Keyboards FTW
a, button
&:hover, &:focus
color: orange
background-color: $dark-gray
class SortableListObserver
constructor: ->
.on('focus', '[data-behavior=sort-handle]', @_handleListItemFocus)
.on('blur', '[data-behavior=sort-handle]', @_handleListItemBlur)
.on('keydown', '[data-behavior=sort-handle]', @_handleListItemKeypress)
.on('keydown', @_handleEscapeKey)
_handleListItemFocus: (event) =>
_handleListItemBlur: (event) =>
_handleListItemKeypress: (event) ->
listItem = $('li')
switch event.which
when App.Keys.ARROW_UP then @_handleArrows(event, listItem, listItem.index() - 1)
when App.Keys.ARROW_DOWN then @_handleArrows(event, listItem, listItem.index() + 1)
_handleEscapeKey: (event) ->
if event.which is App.Keys.ESCAPE
App.PageController.trigger('disableSorting', event)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.