diff --git a/dev/js/spec/containerMenuSpec.js b/dev/js/spec/containerMenuSpec.js
index 26b2fc3..61f919f 100644
--- a/dev/js/spec/containerMenuSpec.js
+++ b/dev/js/spec/containerMenuSpec.js
@@ -282,6 +282,50 @@
         expect(liElements[3]).toBe(undefined);
 
       });
+      
+      it('should switch to the containers prefix whenever the prefix filters the regular list to be empty', function () {
+        /**var list = [
+	        ["Constituency"],
+	        ["Lemma"],
+	        ["Morphology"],
+	        ["Part-of-Speech"],
+	        ["Syntax"]
+        ];
+        */
+        var menu = OwnContainerMenu.create(list,ExampleItemList);
+        menu.container().add("1");
+        menu.show(); // Simulates Buttonpress 1
+        // See function _keypress in containermenu.js (line 147)
+        expect(menu.liveItem()).toBeUndefined(); // no elements in list match "1"
+        expect(menu.container().active()).toBeTruthy(); //thus switch to container
+        var liElements = directElementChildrenByTagName(menu.element(),"li");
+        expect(liElements).toEqual([]);
+        expect(menu.container().liveLength()).toEqual(3); //CI1 and 2, prefix
+        expect(menu._prefix.active()).toBeTruthy(); //  HERE ONLY
+        // We want whichever container item was active before
+        // to stay active, default to prefix if none was.
+
+        //simulate _keydown(...) see containermenu.js line 137
+        menu.container().chop();
+        menu.show();
+        menu.prev();
+        expect(menu._prefix.active()).toBeFalsy();
+        expect(menu.container().item(1).active().toBeTruthy); // at location 1: CIItem 2
+        expect(menu.liveLength()).toEqual(5);
+
+        menu.container().add("1");
+        menu.show(); // Simulates Buttonpress 1
+        // See function _keypress in containermenu.js (line 147)
+        expect(menu.liveItem()).toBeUndefined(); // no elements in list match "1"
+        expect(menu.container().active()).toBeTruthy();
+        var liElements = directElementChildrenByTagName(menu.element(),"li");
+        expect(liElements).toEqual([]);
+        expect(menu.container().liveLength()).toEqual(3); //CI1 and 2, prefix
+        expect(menu.container().item(1).active().toBeTruthy); // at location 1: CIItem 2
+        // We want whichever container item was active before
+        // to stay active, default to prefix if none was.
+
+      });
 
       it('should be nextable', function () {
         var menu = OwnContainerMenu.create(list);
diff --git a/dev/js/src/container/container.js b/dev/js/src/container/container.js
index 60bc0d9..9cf5205 100644
--- a/dev/js/src/container/container.js
+++ b/dev/js/src/container/container.js
@@ -41,13 +41,19 @@
       // after having upgraded a new item scss style to the prefix object.
 
       this.items = new Array();
+      //items are stored in the order they are added in. This includes the prefix.
       if (listOfContainerItems !== undefined) {
         for (let item of listOfContainerItems) {
           this.addItem(item);
         }
       }
 
-      this.position = undefined; //undefined = not in container, 0 to length-1 = in container
+      this.position = undefined; //undefined = not in container,
+      // 0 to length-1 = in container
+
+      this._prefixPosition = undefined; //Required so that switching
+      // to prefix by default is supported
+
 
       
       //t._el.classList.add('visible'); //Done by containermenu
@@ -77,6 +83,7 @@
       prefix.isSelectable =  function () {
         return this.isSet(); //TODO check!
       }
+      this._prefixPosition = this.items.length;
       var prefItem = this.addItem(prefix);
       this._prefix = prefItem;
       if (this._menu !== undefined){
@@ -124,6 +131,26 @@
     },
 
     /**
+     * 
+     * Make the container active without having called prev or next.
+     * Occurs whenever the prefix makes the
+     * menus list empty while we had it selected.
+     * This potentially requires adjusting this.position.
+     */
+     makeActive : function () {
+      if (this.position === undefined) {
+        if (this._prefix.isSelectable()) {
+          this.position = this._prefixPosition; //make prefix active if it exists
+          this.item().active(true);
+        } else if (this.liveLength() > 0) {
+          this.position = 0;
+          this._prefix.active(false); // usually the menu makes the prefix active anyway.
+          this.item().active(true);
+        }
+      }
+    },
+
+    /**
      * Move on to the next item in container. Returns true if we then leave the container, false otherwise.
      */
     next : function() {
diff --git a/dev/js/src/containermenu.js b/dev/js/src/containermenu.js
index a272e10..865c3ec 100644
--- a/dev/js/src/containermenu.js
+++ b/dev/js/src/containermenu.js
@@ -165,7 +165,7 @@
      * @param {string} Prefix for filtering the list
      */
     show : function (active) {
-      //there are only two new lines, marked with NEW
+      //There are only four new lines, marked with NEW
       const t = this;
 
       // show menu based on initial offset
@@ -177,11 +177,13 @@
       if (!t._initList()) {
 
         // The prefix is not active
-        t._prefix.active(true);
+        t._prefix.active(true);        
+        t.container().makeActive(); //NEW Incase the own
+        // list becomes empty we need to make container active for line 129 to work
 
         // finally show the element
-        t._el.classList.add('visible'); // TODO do I need this for container?
-        t.container()._el.classList.add('visible');
+        t._el.classList.add('visible');
+        t.container()._el.classList.add('visible'); //NEW
 
         return true;
       };
