diff options
author | Florrie <towerofnix@gmail.com> | 2018-06-03 18:03:33 -0300 |
---|---|---|
committer | Florrie <towerofnix@gmail.com> | 2018-06-03 18:03:33 -0300 |
commit | 94ce17c784b7a9caa16522de67bf8b364f01d370 (patch) | |
tree | 8d39542dd1e48ecbc20bdee58fc83bc42d320f2d | |
parent | f64bd0252741a749b1f3bc57d79b134ecf42afcb (diff) |
Fix issue when a group being exited is the first item in its parent
-rw-r--r-- | ui.js | 8 |
1 files changed, 7 insertions, 1 deletions
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() } |