starlight-cannoli-plugins 2.10.4 → 2.10.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -146,11 +146,7 @@ function tabbedH2Content() {
|
|
|
146
146
|
contentContainer.appendChild(tabbedWrapper);
|
|
147
147
|
contentContainer.appendChild(paginationBar);
|
|
148
148
|
let activeTabIndex = 0;
|
|
149
|
-
function
|
|
150
|
-
const rect = tabNav.getBoundingClientRect();
|
|
151
|
-
return rect.top < window.innerHeight && rect.bottom > 0;
|
|
152
|
-
}
|
|
153
|
-
function activateTab(targetIndex, updateHash = true, scrollToNav = false) {
|
|
149
|
+
function activateTab(targetIndex, updateHash = true) {
|
|
154
150
|
const applySwitch = () => {
|
|
155
151
|
tabPanels[activeTabIndex].style.viewTransitionName = "";
|
|
156
152
|
activeTabIndex = targetIndex;
|
|
@@ -177,9 +173,6 @@ function tabbedH2Content() {
|
|
|
177
173
|
block: "nearest",
|
|
178
174
|
inline: "nearest"
|
|
179
175
|
});
|
|
180
|
-
if (scrollToNav) {
|
|
181
|
-
tabNav.scrollIntoView({ behavior: scrollBehavior, block: "nearest" });
|
|
182
|
-
}
|
|
183
176
|
if (updateHash) {
|
|
184
177
|
const targetHeadingId = allSections[targetIndex].headingId;
|
|
185
178
|
if (targetHeadingId) {
|
|
@@ -218,17 +211,23 @@ function tabbedH2Content() {
|
|
|
218
211
|
if (targetPanelIndex >= 0 && targetPanelIndex !== activeTabIndex)
|
|
219
212
|
activateTab(targetPanelIndex, false);
|
|
220
213
|
}
|
|
214
|
+
function isTabNavVisible() {
|
|
215
|
+
const rect = tabNav.getBoundingClientRect();
|
|
216
|
+
return rect.top < window.innerHeight && rect.bottom > 0;
|
|
217
|
+
}
|
|
221
218
|
function wireInteractions(viewToggleCheckbox2) {
|
|
222
219
|
prevTabButton.addEventListener("click", () => {
|
|
223
220
|
if (activeTabIndex > 0) {
|
|
224
|
-
|
|
225
|
-
|
|
221
|
+
if (!isTabNavVisible())
|
|
222
|
+
window.scrollTo({ top: 0, behavior: "instant" });
|
|
223
|
+
activateTab(activeTabIndex - 1);
|
|
226
224
|
}
|
|
227
225
|
});
|
|
228
226
|
nextTabButton.addEventListener("click", () => {
|
|
229
227
|
if (activeTabIndex < allSections.length - 1) {
|
|
230
|
-
|
|
231
|
-
|
|
228
|
+
if (!isTabNavVisible())
|
|
229
|
+
window.scrollTo({ top: 0, behavior: "instant" });
|
|
230
|
+
activateTab(activeTabIndex + 1);
|
|
232
231
|
}
|
|
233
232
|
});
|
|
234
233
|
tabButtons.forEach((tabButton, buttonIndex) => {
|
package/package.json
CHANGED