Skip to content

Commit a4547c9

Browse files
committed
hide tabs when searching
1 parent 9a086f5 commit a4547c9

2 files changed

Lines changed: 24 additions & 1 deletion

File tree

docs/stylesheets/extra.css

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,8 @@
168168
font-size: 0.68rem;
169169
min-width: 0;
170170
white-space: nowrap;
171-
overflow: visible;
171+
overflow: hidden;
172+
text-overflow: ellipsis;
172173
}
173174

174175
.cs-tabs-inline .md-tabs__item--active .md-tabs__link,
@@ -177,6 +178,14 @@
177178
box-shadow: inset 0 -2px 0 #ff3d6c;
178179
}
179180

181+
/* Collapse tabs when search is focused to prevent overlap */
182+
.cs-search-open .cs-header-tabs {
183+
opacity: 0;
184+
pointer-events: none;
185+
transform: translateY(-4px);
186+
transition: opacity 0.15s ease, transform 0.15s ease;
187+
}
188+
180189
/* Footer: revert to theme defaults (remove custom padding hacks) */
181190

182191
.cs-tabs-inline .md-tabs {

overrides/main.html

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,20 @@
115115
function init() {
116116
updateTabsLayout();
117117
window.addEventListener("resize", debounce(updateTabsLayout, 150));
118+
119+
// Hide tabs when search is active to avoid overlaps.
120+
const searchInput = document.querySelector(".md-search__input");
121+
if (searchInput) {
122+
const onOpen = () => root.classList.add("cs-search-open");
123+
const onClose = () => root.classList.remove("cs-search-open");
124+
searchInput.addEventListener("focus", onOpen);
125+
searchInput.addEventListener("blur", onClose);
126+
document.addEventListener("keydown", (event) => {
127+
if (event.key === "Escape") {
128+
onClose();
129+
}
130+
});
131+
}
118132
}
119133

120134
if (document.readyState === "loading") {

0 commit comments

Comments
 (0)