Minor changes to menu
diff --git a/dev/demo/menudemo.js b/dev/demo/menudemo.js
index 1df0f55..35e2170 100644
--- a/dev/demo/menudemo.js
+++ b/dev/demo/menudemo.js
@@ -71,6 +71,7 @@
document.getElementById('menu').appendChild(menu.element());
+ menu._active = 2;
menu.limit(3);
menu.show('');
menu.focus();
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;
diff --git a/dev/scss/header/header.scss b/dev/scss/header/header.scss
index e84d912..b2b9d6c 100644
--- a/dev/scss/header/header.scss
+++ b/dev/scss/header/header.scss
@@ -39,6 +39,9 @@
color: $dark-green;
border-color: $dark-green;
}
+ &.active {
+ border-color: $dark-orange;
+ }
&::after {
pointer-events: none;
font-family: FontAwesome;