diff options
author | Florrie <towerofnix@gmail.com> | 2020-05-04 13:29:30 -0300 |
---|---|---|
committer | Florrie <towerofnix@gmail.com> | 2020-05-04 13:29:30 -0300 |
commit | 705c424332fb92ff3ce1fc3b35b2f18bd9e4c8e3 (patch) | |
tree | 2c9ab90307088369c73a17ff4e482b781e2d80b4 | |
parent | e7a005f948415afae89a1a2aaa435d1839f4002e (diff) |
select child grouplike when loading parent
This was already the previous behavior, but a misplaced restoreGrouplikeData was overwriting that effect. With this commit, the scroll position will still be restored, but the selected item will be correctly changed to whichever was opened. (This arguably means it's no longer necessary to restore the selected item in save/restoreGrouplikeData at all, but it's kept there in case a grouplike is ever unloaded through some means besides opening its child -- actually this is the case if you reveal an item whos ancestor groups don't fully overlap with that of the previously open group.)
-rw-r--r-- | ui.js | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/ui.js b/ui.js index 1ed8c42..7bbfd84 100644 --- a/ui.js +++ b/ui.js @@ -1911,17 +1911,18 @@ class GrouplikeListingElement extends Form { const parent = this.grouplike[parentSymbol] if (parent) { + const form = this.form const oldGrouplike = this.grouplike + this.loadGrouplike(parent) + form.curIndex = form.firstItemIndex + this.restoreGrouplikeData() - const form = this.form const index = form.inputs.findIndex(inp => inp.item === oldGrouplike) if (typeof index === 'number') { form.curIndex = index - } else { - form.curIndex = form.firstItemIndex } - this.restoreGrouplikeData() + form.updateSelectedElement() form.scrollSelectedElementIntoView() } |