fix(nav): remember open folder, Tutorial Navigator first, fix palette + channels - #2162
Merged
Conversation
…x palette+channels double-encode
- header.html nav-data: pipe | safeJS so the ⌘K palette receives a real JSON
object (was double-encoded to a string → parsed.groups undefined → EXPLORE
group empty). Fixes all-nav-options-missing-from-palette regression.
- channels/list.html channel-collections-data: same | safeJS fix; the
channels-directory island was crashing on the double-encoded "[]" string
(visibleCollections("[]").filter is not a function) → only the submit row showed.
- navigation.yaml: move Tutorial Navigator to first entry in the Learn group.
- header.html accordion: persist the last-open group to localStorage and restore
it on load (single-open behavior preserved), so navigation continues where it
left off.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Four navigation-menu improvements Tom requested.
Changes
header.html<script id="nav-data">now pipes| jsonify | safeJS. It was emitting a double-encoded JSON string, so the ⌘K palette'sJSON.parseyielded a string,parsed.groupswas undefined, and the EXPLORE group came up empty. This is why "all navigation options are missing from the Palette."channels/list.htmlchannel-collections-datagets the same| safeJS. The double-encoded"[]"made thechannels-directoryisland throwvisibleCollections("[]").filter is not a function, so only the "suggest a new item" row rendered. (236 channels exist in the data.)navigation.yaml.localStorage(sb-nav-open-group) and restores it on load. Single-open accordion behavior is preserved (Tom's choice); empty string = user collapsed everything.No island TypeScript changed — all four are Hugo template/data edits the pre-built islands read at runtime.
safeJSmatches the proven sibling pattern already used onchannels-data(list.html:11) andfeedback-share.html.Testing
test/unit/hugo/header-nav-includes-explore.test.tspasses (YAML parses, header still ranges the data).navigation.yamlvalidated withyq; accordion JS selectors verified against the template'sdata-nav-group/data-nav-itemsattributes.