diff --git a/source/_static/js/instantSearch.js b/source/_static/js/instantSearch.js index 3e9504a9..60e2d7a8 100644 --- a/source/_static/js/instantSearch.js +++ b/source/_static/js/instantSearch.js @@ -123,13 +123,6 @@ window.addEventListener("DOMContentLoaded", () => { clearRefinements(); } - // Clear the filters on x click - document - .querySelector(".search__reset") - .addEventListener("click", () => { - clearRefinements("btn"); - }); - // Fire the search search(query); }, @@ -271,7 +264,7 @@ window.addEventListener("DOMContentLoaded", () => { return false; } - return ` + return ` ${returnString} `; }, @@ -325,13 +318,31 @@ window.addEventListener("DOMContentLoaded", () => { }); }); + // Clear the filters on x click + document.addEventListener("click", (e) => { + if(e.target.classList.contains("search__reset")) { + clearRefinements("btn"); + } + }, false); + + // Close the search modal on outside click + document.addEventListener("pointerdown", function (e) { + if (e.target.id === "search") { + closeSearchModal(); + } + }) + + // Keyboard events document.addEventListener( "keydown", (e) => { // Close the search on esc key press if (e.key === "Escape") { - closeSearchModal(); + if(searchModalEl.classList.contains("search--focused") + || searchModalEl.classList.contains("search--active")) { + closeSearchModal(); + } } // Focus the search input on "Meta + K" key press diff --git a/source/_static/js/main.js b/source/_static/js/main.js index d41722fe..87e61078 100644 --- a/source/_static/js/main.js +++ b/source/_static/js/main.js @@ -361,4 +361,18 @@ window.addEventListener("DOMContentLoaded", (event) => { }); } })(); + + // -------------------------------------------------- + // Handle internal and external links + // -------------------------------------------------- + (function () { + const links = document.querySelectorAll(".content__main a.external"); + if(links.length > 0) { + links.forEach((item) => { + item.setAttribute("target", "_blank"); + item.setAttribute("rel", "noopener"); + item.setAttribute("rel", "noreferrer"); + }); + } + })(); }); \ No newline at end of file diff --git a/source/_static/scss/includes/_nav.scss b/source/_static/scss/includes/_nav.scss index a3224a58..01b2d241 100644 --- a/source/_static/scss/includes/_nav.scss +++ b/source/_static/scss/includes/_nav.scss @@ -544,7 +544,6 @@ font-style: normal; width: fit-content; color: var(--text-muted-color); - transition: background-color 200ms; } &:hover { diff --git a/source/_static/scss/includes/_search.scss b/source/_static/scss/includes/_search.scss index 232c6014..cf1839bb 100644 --- a/source/_static/scss/includes/_search.scss +++ b/source/_static/scss/includes/_search.scss @@ -155,6 +155,7 @@ & > svg { width: 0.5rem; fill: var(--text-color); + pointer-events: none; } } @@ -277,6 +278,7 @@ align-items: center; line-height: 1; margin-top: 0.35rem; + min-height: 1rem; .search__hits__platform { margin-top: 0; diff --git a/source/_templates/head.html b/source/_templates/head.html index 32870123..42822c82 100644 --- a/source/_templates/head.html +++ b/source/_templates/head.html @@ -3,9 +3,9 @@ - - - + + +