Fixed arrow key handling in empty lists
diff --git a/dev/js/src/menu.js b/dev/js/src/menu.js
index ed6b6c4..b2c541e 100644
--- a/dev/js/src/menu.js
+++ b/dev/js/src/menu.js
@@ -7,7 +7,6 @@
* TODO: space is not a valid prefix!
* TODO: Show the slider briefly on move (whenever screen is called).
* TODO: Optimize scrolling to active item.
- * TODO: Handle arrow keys correctly when list is empty.
*/
define([
'menu/item',
@@ -584,6 +583,10 @@
};
};
+ // No list
+ if (this.liveLength() === 0)
+ return;
+
this.position++;
newItem = this.liveItem(this.position);
@@ -628,10 +631,14 @@
// No active element set
if (this.position === -1) {
- return;
// TODO: Choose last item
+ return;
};
+ // No list
+ if (this.liveLength() === 0)
+ return;
+
var newItem;
// Set new live item