From 94ce17c784b7a9caa16522de67bf8b364f01d370 Mon Sep 17 00:00:00 2001 From: Florrie Date: Sun, 3 Jun 2018 18:03:33 -0300 Subject: Fix issue when a group being exited is the first item in its parent --- ui.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'ui.js') diff --git a/ui.js b/ui.js index 73442d0..241bf99 100644 --- a/ui.js +++ b/ui.js @@ -378,7 +378,13 @@ class GrouplikeListingElement extends ListScrollForm { if (parent) { const oldGrouplike = this.grouplike this.loadGrouplike(parent) - this.curIndex = this.inputs.findIndex(inp => inp.item === oldGrouplike) || this.firstItemIndex + + const index = this.inputs.findIndex(inp => inp.item === oldGrouplike) + if (typeof index === 'number') { + this.curIndex = index + } else { + this.curIndex = this.firstItemIndex + } this.updateSelectedElement() this.scrollSelectedElementIntoView() } -- cgit 1.3.0-6-gf8a5