Skip to content

Commit efed748

Browse files
committed
fix bug with search bar on screen resize
1 parent d1f8e30 commit efed748

2 files changed

Lines changed: 18 additions & 1 deletion

File tree

web-components/nav-header/nav-header.css

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,10 +249,18 @@ input {
249249
#search-input {
250250
display: none;
251251
}
252+
253+
/* form input {
254+
font-size: 1em;
255+
} */
252256
}
253257

254258
/* 1024px and above screen sizes */
255259
@media screen and (min-width: 64em) {
260+
.site-header {
261+
display: block;
262+
}
263+
256264
#search-input {
257265
display: block;
258266
}

web-components/nav-header/nav-header.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,6 @@ function createComponent(html) {
9292
searchForm.classList.add("search-bar-open");
9393
searchBar.classList.add("search-bar-open");
9494
} else {
95-
console.log("close");
9695
siteHeader.style.display = "block";
9796
searchInput.style.display = "none";
9897
navigation.classList.remove("search-bar-open");
@@ -104,7 +103,17 @@ function createComponent(html) {
104103

105104
window.addEventListener("resize", () => {
106105
if (window.innerWidth >= 1024) {
106+
siteHeader.style.display = "block";
107107
searchInput.style.display = "block";
108+
navigation.classList.remove("search-bar-open");
109+
searchForm.classList.remove("search-bar-open");
110+
searchBar.classList.remove("search-bar-open");
111+
} else {
112+
siteHeader.style.display = "block";
113+
searchInput.style.display = "none";
114+
navigation.classList.remove("search-bar-open");
115+
searchForm.classList.remove("search-bar-open");
116+
searchBar.classList.remove("search-bar-open");
108117
}
109118
});
110119

0 commit comments

Comments
 (0)