Skip to content

Commit 10880b7

Browse files
Merge branch 'main' into release/v25.0
2 parents 8d2b9fa + 8acb505 commit 10880b7

File tree

4 files changed

+56
-8
lines changed

4 files changed

+56
-8
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
<div class="tab-pane" title="{{ upper (.Get 0) }}">
2-
{{ .Inner }}
2+
{{ .Inner | markdownify }}
33
</div>

themes/hugo-docs/static/css/tabs.css

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
.tabs .nav-tabs {
22
border-bottom: none;
3+
padding: 0;
34
}
45

56
.nav-tabs > li {
@@ -12,7 +13,6 @@
1213
border-bottom: none;
1314
border-top-left-radius: 4px;
1415
border-top-right-radius: 4px;
15-
box-shadow: 0 0 0.5em rgba(0, 0, 0, 0.0625);
1616
background: #fff;
1717
}
1818

@@ -25,10 +25,17 @@
2525
padding: 0.5em 0.75em;
2626
border: 1px solid #ddd;
2727
border-radius: 4px;
28-
box-shadow: 0 0 0.5em rgba(0, 0, 0, 0.0625);
2928
background: #fff;
3029
}
3130

31+
.tab-content > .tab-pane {
32+
display: none;
33+
}
34+
35+
.tab-content > .tab-pane.active {
36+
display: block;
37+
}
38+
3239
.nav-tabs li a {
3340
/* position: relative; */
3441
color: #232323;
@@ -38,3 +45,22 @@
3845
/* position: relative; */
3946
color: #bd4147;
4047
}
48+
49+
/* Dark mode support */
50+
.dark-blog .tabs .nav-tabs > li {
51+
background: #2a2a2a;
52+
border-color: #444;
53+
}
54+
55+
.dark-blog .tabs .tab-content {
56+
background: #2a2a2a;
57+
border-color: #444;
58+
}
59+
60+
.dark-blog .nav-tabs li a {
61+
color: #e0e0e0;
62+
}
63+
64+
.dark-blog .nav-tabs li.active a {
65+
color: #ef265a;
66+
}

themes/hugo-docs/static/css/theme.css

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2734,7 +2734,11 @@ body:not(.dark-blog) .single-footer .legal-notices-wrap:hover .legal-notices {
27342734
}
27352735

27362736
.tab-content>.tab-pane {
2737-
display: block !important;
2737+
display: none;
2738+
}
2739+
2740+
.tab-content>.tab-pane.active {
2741+
display: block;
27382742
}
27392743

27402744
@media all and (max-width: 1024px) {

themes/hugo-docs/static/js/dgraph.js

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -405,30 +405,48 @@ function setAlgolia(latestVersion) {
405405
});
406406
}
407407
$(document).ready(function () {
408+
// Initialize tabs: create nav items from tab panes
408409
$(".tab-content")
409410
.find(".tab-pane")
410411
.each(function (idx, item) {
411412
const navTabs = $(this).closest(".tabs").find(".nav-tabs");
412413
const title = $(this).attr("title");
413-
navTabs.append(`<li><a href="#">${title}</a></li>`);
414+
navTabs.append(`<li><a href="#" role="button" tabindex="0">${title}</a></li>`);
414415
});
415416

417+
// Set first tab as active in each tab group
416418
$(".tabs ul.nav-tabs").each(function () {
417419
$(this).find("li:first").addClass("active");
418420
});
419421

422+
// Set first pane as active in each tab group
420423
$(".tabs .tab-content").each(function () {
421424
$(this).find("div:first").addClass("active");
422425
});
423426

424-
$(".nav-tabs a").click(function (e) {
427+
// Use event delegation for tab switching (works even if tabs are added dynamically)
428+
$(document).on("click", ".nav-tabs a", function (e) {
425429
e.preventDefault();
426-
const tab = $(this).parent();
430+
e.stopPropagation();
431+
const tab = $(this).parent("li");
427432
const tabIndex = tab.index();
428433
const tabPanel = $(this).closest(".tabs");
429434
const tabPane = tabPanel.find(".tab-pane").eq(tabIndex);
430-
tabPanel.find(".active").removeClass("active");
435+
436+
// Remove active class from all tabs and panes in this group
437+
tabPanel.find(".nav-tabs li").removeClass("active");
438+
tabPanel.find(".tab-pane").removeClass("active");
439+
440+
// Add active class to clicked tab and corresponding pane
431441
tab.addClass("active");
432442
tabPane.addClass("active");
433443
});
444+
445+
// Also support keyboard navigation (Enter/Space)
446+
$(document).on("keydown", ".nav-tabs a", function (e) {
447+
if (e.key === "Enter" || e.key === " ") {
448+
e.preventDefault();
449+
$(this).click();
450+
}
451+
});
434452
});

0 commit comments

Comments
 (0)