Skip to content

Commit

Permalink
Merge pull request #2164 from OctopusDeploy/km/search-fixes
Browse files Browse the repository at this point in the history
Fixed enter submit issue and some styling
  • Loading branch information
steve-fenton-octopus authored Feb 15, 2024
2 parents 124a086 + a6ee0ad commit e04a47a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
3 changes: 2 additions & 1 deletion public/docs/css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -1398,7 +1398,7 @@ a[data-youtube] {
padding: 110px 1em 2rem 1em;
max-height: 100vh;
overflow-y: auto;
z-index: 0;
z-index: 1;
}

/* Site Search */
Expand Down Expand Up @@ -1492,6 +1492,7 @@ a[data-youtube] {

.search-results__heading {
visibility: hidden;
padding: 1.5rem 3.6rem 1.75rem;
}

.site-search.is-active+.site-search-results>.search-results__heading {
Expand Down
12 changes: 6 additions & 6 deletions public/docs/js/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ async function search(s, r) {
if (s && s.trim().length > 0) {
activateInput();
openDropdown();
} else {
} else if(siteSearchElement.classList.contains('is-active')){
// Remove 'is-active' class when search is cleared
closeDropdown();
}
Expand Down Expand Up @@ -474,11 +474,11 @@ async function search(s, r) {
ul.appendChild(li);
}

let h2;
let h4;
if (needles.length === 0) {
h2 = document.createElement('h2');
h2.classList.add('search-results__heading');
h2.innerHTML = results.dataset.emptytitle || 'No Results';
h4 = document.createElement('h4');
h4.classList.add('search-results__heading');
h4.innerHTML = results.dataset.emptytitle || 'No Results';
}

const more = document.createElement('button');
Expand All @@ -494,7 +494,7 @@ async function search(s, r) {

results.innerHTML = '';
results.appendChild(ul);
h2 && results.appendChild(h2);
h4 && results.appendChild(h4);

if (needles.length > numberOfResults) {
results.appendChild(more);
Expand Down
2 changes: 1 addition & 1 deletion src/themes/accelerator/components/Search.astro
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ const searchUrl =
autocomplete="off"
data-site-search-query
/>
<button class="site-search__remove-btn" data-site-search-remove>
<button class="site-search__remove-btn" type="button" data-site-search-remove>
<svg
xmlns="http://www.w3.org/2000/svg"
width="11"
Expand Down

0 comments on commit e04a47a

Please sign in to comment.