Skip to content

Commit ef7bf8f

Browse files
Handle headers within tabpanels
1 parent 4636a52 commit ef7bf8f

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

assets/js/shortcuts.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,15 +98,24 @@ function setupShortcuts(shortcutDepth = 2) {
9898

9999
shortcutDepth += 1; // to account for the page title
100100

101-
// Build a class selector for each header type, and concatenate with commas
101+
/*
102+
* We have build selectors to find headers in different contexts.
103+
* i. direct children of .content-container (main structure)
104+
* i. headers within tabpanels (for tabbed content)
105+
*/
102106
let classes = "";
107+
103108
for (let i = 2; i <= shortcutDepth; i++) {
104109
if (i != 2) {
105110
classes += ",";
106111
}
107112
classes += " .content-container > h" + i;
108113
}
109114

115+
for (let i = 2; i <= shortcutDepth; i++) {
116+
classes += ", [role='tabpanel'] > h" + i;
117+
}
118+
110119
const classElements = Array.from(document.querySelectorAll(classes));
111120

112121
// Only proceed if we found headers (to avoid creating an empty shortcuts section)

0 commit comments

Comments
 (0)