Guard against no other focusable elements

This previously occurred in areas we all the elements had a -1 tabindex
 or were disabled.
This commit is contained in:
Kevin Sawicki
2013-12-16 13:52:13 -08:00
parent 7c27cbd9f5
commit 9cdc15b161

View File

@@ -124,7 +124,10 @@ class WindowEventHandler
nextTabIndex = tabIndex
nextElement = element
(nextElement ? lowestElement).focus()
if nextElement?
nextElement.focus()
else if lowestElement?
lowestElement.focus()
focusPrevious: =>
focusedTabIndex = parseInt($(':focus').attr('tabindex')) or Infinity
@@ -142,4 +145,7 @@ class WindowEventHandler
previousTabIndex = tabIndex
previousElement = element
(previousElement ? highestElement).focus()
if previousElement?
previousElement.focus()
else if highestElement?
highestElement.focus()