Skip to content

Commit f26c503

Browse files
Update content wrapper + container selectors
1 parent 5f298bc commit f26c503

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

assets/js/shortcuts.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -98,24 +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
102-
// This adds selectors for leaf bundles (index.md files).
101+
/*
102+
* Build selectors for both patterns:
103+
* 1. Direct children of .content-container (for headers directly in the container)
104+
* 2. Headers within wrappers inside .content-container (for when content-wrapper is used)
105+
*
106+
* This works with both DOM structures we might encounter, whether the templates
107+
* have been updated to use content-wrapper or not (just in case).
108+
*/
103109
let classes = "";
104110
for (let i = 2; i <= shortcutDepth; i++) {
105111
if (i != 2) {
106112
classes += ",";
107113
}
108-
classes += " .content-container :not([role='tabpanel']) > h" + i;
114+
classes += " .content-container > h" + i;
109115
}
110116

111-
/*
112-
* Add selectors for branch bundles (_index.md files). In this case,
113-
* branch bundles often have a different DOM structure than leaf bundles,
114-
* so we need to include headers that are direct children of the content
115-
* container here.
116-
*/
117117
for (let i = 2; i <= shortcutDepth; i++) {
118-
classes += ", .content-container > h" + i;
118+
classes += ", .content-wrapper > h" + i;
119119
}
120120

121121
const classElements = Array.from(document.querySelectorAll(classes));

0 commit comments

Comments
 (0)