Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions hugo/data/navigation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ groups:
- id: learn
label: Learn
items:
- id: nav-tutorial-navigator
label: Tutorial Navigator
href: /tutorial-navigator/
icon: course-book
keywords: [tutorial, navigator, catalog, browse tutorials, learn]
- id: explore-learn
label: Learn
href: /learn/
Expand Down Expand Up @@ -74,11 +79,6 @@ groups:
paletteLabel: Connect — events, advocates, community
paletteIcon: group
keywords: [connect, community, events, advocates, codejam, devtoberfest, verb]
- id: nav-tutorial-navigator
label: Tutorial Navigator
href: /tutorial-navigator/
icon: course-book
keywords: [tutorial, navigator, catalog, browse tutorials, learn]
- id: explore
label: Explore
items:
Expand Down
2 changes: 1 addition & 1 deletion hugo/layouts/channels/list.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ <h1>{{ .Title }}</h1>
<p>{{ .Description }}</p>
</header>
<script id="channel-collections-data" type="application/json">
{{ with .Site.Data.channel_collections }}{{ .collections | jsonify }}{{ else }}[]{{ end }}
{{ with .Site.Data.channel_collections }}{{ .collections | jsonify | safeJS }}{{ else }}[]{{ end }}
</script>
<script id="channels-data" type="application/json">{{ $channels | jsonify | safeJS }}</script>
<div data-island="channels-directory"></div>
Expand Down
33 changes: 24 additions & 9 deletions hugo/layouts/partials/header.html
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
</ui5-list>
</div>
</ui5-popover>
<script id="nav-data" type="application/json">{{ site.Data.navigation | jsonify }}</script>
<script id="nav-data" type="application/json">{{ site.Data.navigation | jsonify | safeJS }}</script>

<ui5-popover id="sb-share-popover" placement="Bottom" horizontal-align="End" hide-arrow header-text="Share & feedback">
<div class="share-popover__body">
Expand Down Expand Up @@ -245,17 +245,32 @@
// Two-level accordion: clicking a group header opens its list and closes the
// others (single-open keeps the menu compact on mobile). The first group ships
// expanded (aria-expanded="true" in the template) so the verb spine stays
// visible at a glance on desktop.
// visible at a glance on desktop. The last-open group is remembered in
// localStorage and restored on the next load so navigation can continue where
// it left off (empty string = user collapsed everything).
const NAV_OPEN_KEY = 'sb-nav-open-group';
const setOpenGroup = (groupId) => {
navPopover.querySelectorAll('.nav-group__header').forEach(b => b.setAttribute('aria-expanded', 'false'));
navPopover.querySelectorAll('.nav-group__items').forEach(l => l.setAttribute('hidden', ''));
if (!groupId) return;
const header = navPopover.querySelector('.nav-group__header[data-nav-group="' + groupId + '"]');
const list = navPopover.querySelector('.nav-group__items[data-nav-items="' + groupId + '"]');
if (header && list) {
header.setAttribute('aria-expanded', 'true');
list.removeAttribute('hidden');
}
};
// Restore the remembered group (null = untouched, keep the template default).
try {
const stored = localStorage.getItem(NAV_OPEN_KEY);
if (stored !== null) setOpenGroup(stored);
} catch (e) { /* storage blocked; keep template default */ }
document.querySelectorAll('#sb-nav-popover .nav-group__header').forEach(btn => {
btn.addEventListener('click', () => {
const wasOpen = btn.getAttribute('aria-expanded') === 'true';
navPopover.querySelectorAll('.nav-group__header').forEach(b => b.setAttribute('aria-expanded', 'false'));
navPopover.querySelectorAll('.nav-group__items').forEach(l => l.setAttribute('hidden', ''));
if (!wasOpen) {
btn.setAttribute('aria-expanded', 'true');
const list = navPopover.querySelector('.nav-group__items[data-nav-items="' + btn.getAttribute('data-nav-group') + '"]');
if (list) list.removeAttribute('hidden');
}
const groupId = wasOpen ? '' : btn.getAttribute('data-nav-group');
setOpenGroup(groupId);
try { localStorage.setItem(NAV_OPEN_KEY, groupId); } catch (e) { /* storage blocked */ }
});
});

Expand Down
Loading