Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions css/components/header.css
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,13 @@
box-sizing: border-box;
}

@media (min-width: 1040px) and (max-width: 1280px) {
.site-header__container {
gap: var(--space-sm);
padding: 0 var(--space-md);
}
}

@media (max-width: 767px) {
.site-header__container {
padding: 0 var(--space-md);
Expand Down Expand Up @@ -153,6 +160,12 @@
margin: 0;
}

@media (max-width: 1280px) {
.site-header__navigation ul {
gap: var(--space-md);
}
}

.site-header__navigation li {
margin: 0;
padding: 0;
Expand Down
2 changes: 0 additions & 2 deletions static/mobile-menu.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// Mobile Menu Toggle - Simple and Robust

// Wait for DOM to be fully loaded
document.addEventListener('DOMContentLoaded', function() {
const menuToggle = document.getElementById('mobile-menu-toggle');
Expand Down
10 changes: 8 additions & 2 deletions static/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,14 @@ const headerContainer = document.querySelector(".site-header__container");
let searchItemSelected = null;
let resultsItemsIndex = -1;

// Function to update search container class based on input content
// Function to update search container class based on input content and focus
function updateSearchContainerClass() {
if (searchInput && searchContainer) {
if (searchInput.value.trim() !== "") {
const hasContent = searchInput.value.trim() !== "";
const isFocused = document.activeElement === searchInput;

// Keep expanded if input has content OR is focused
if (hasContent || isFocused) {
searchContainer.classList.add("has-content");
if (headerContainer) {
headerContainer.classList.add("search-expanded");
Expand Down Expand Up @@ -213,13 +217,15 @@ function initSearch() {
updateSearchContainerClass();
});
searchInput.addEventListener("focusin", function () {
updateSearchContainerClass();
if (searchInput.value !== "") {
showResults(index)();
}
});

searchInput.addEventListener("focusout", function () {
resultsItemsIndex = -1;
updateSearchContainerClass();
});

window.addEventListener("click", function (mouseEvent) {
Expand Down
2 changes: 1 addition & 1 deletion templates/header.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

<!-- Search (always visible, but styled differently on mobile) -->
<div class="site-header__search">
<input type="search" id="search" autocomplete="off" placeholder="Search docs and API...">
<input type="search" id="search" autocomplete="off" placeholder="Search the documentation and API">
<div id="search-results" class="search-results">
<ul id="search-results__items" class="search-results__items"></ul>
</div>
Expand Down
Loading