From 705c424332fb92ff3ce1fc3b35b2f18bd9e4c8e3 Mon Sep 17 00:00:00 2001 From: Florrie Date: Mon, 4 May 2020 13:29:30 -0300 Subject: 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.) --- ui.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'ui.js') 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() } -- cgit 1.3.0-6-gf8a5