Minor changes to menu
diff --git a/dev/js/spec/menuSpec.js b/dev/js/spec/menuSpec.js
index 00fb8af..2b4e8f6 100644
--- a/dev/js/spec/menuSpec.js
+++ b/dev/js/spec/menuSpec.js
@@ -776,6 +776,7 @@
expect(menu.prefix("exit").show()).toBe(false);
});
+
it('should be navigatable with prefix', function () {
var menu = KorAP.HintMenu.create("cnx/", demolist);
menu._firstActive = true;
@@ -1067,7 +1068,12 @@
xit('should be page downable');
xit('should be page upable');
- xit('should scroll to a chosen value');
+ it('should scroll to a chosen value', function () {
+ var menu = KorAP.OwnMenu.create(demolist);
+ menu.limit(3);
+ this._active = 5;
+ });
+
xit('should highlight a chosen value');
});
diff --git a/dev/js/src/menu.js b/dev/js/src/menu.js
index 0e7fc44..2d9aacb 100644
--- a/dev/js/src/menu.js
+++ b/dev/js/src/menu.js
@@ -203,6 +203,7 @@
this._element = e;
this.active = false;
+ // this.selected = undefined;
this._items = new Array();
var i;
@@ -292,12 +293,19 @@
if (this._firstActive)
this.liveItem(0).active(true);
+ this._position = 0;
+
this._prefix.active(false);
- this._active = this._list[0];
- this._position = 0;
this._element.style.opacity = 1;
+ // Iterate to the active item
+ if (this._active !== -1 && !this._prefix.isSet()) {
+ while (this._list[this._position] < this._active) {
+ this.next();
+ };
+ };
+
// Add classes for rolling menus
this._boundary(true);
return true;