Commit a2cdd012 by Tom Giannattasio

arrow key navigation on topic drop for filtered items

parent 6e0ddf14
...@@ -170,17 +170,22 @@ class @DiscussionThreadListView extends Backbone.View ...@@ -170,17 +170,22 @@ class @DiscussionThreadListView extends Backbone.View
return return
event.preventDefault() event.preventDefault()
items = $(".browse-topic-drop-menu-wrapper a").not(".hidden") totalItems = $(".browse-topic-drop-menu-wrapper a").length
totalItems = items.length index = $(".browse-topic-drop-menu-wrapper .focused").parent().index()
index = $(".browse-topic-drop-menu-wrapper .focused").parent().index() firstShownIndex = $($(".browse-topic-drop-menu-wrapper a").not('.hidden')[0]).parent().index()
if event.which == 40 if event.which == 40
index = index + 1 index = index + 1
else if event.which == 38 else if event.which == 38
index = index - 1 index = index - 1
while $(".browse-topic-drop-menu-wrapper li").eq(index).find('a').hasClass('hidden')
index--;
if index == totalItems if index == totalItems
index = 0 index = 0
while $(".browse-topic-drop-menu-wrapper li").eq(index).find('a').hasClass('hidden')
index++;
$(".browse-topic-drop-menu-wrapper .focused").removeClass("focused") $(".browse-topic-drop-menu-wrapper .focused").removeClass("focused")
$(".browse-topic-drop-menu-wrapper li").eq(index).find('a').addClass("focused") $(".browse-topic-drop-menu-wrapper li").eq(index).find('a').addClass("focused")
$(".browse-topic-drop-menu-wrapper").attr("data-focused", index) $(".browse-topic-drop-menu-wrapper").attr("data-focused", index)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment