Skip to content

Commit

Permalink
pw_docs: Fix search results increasing in width
Browse files Browse the repository at this point in the history
Change-Id: Ida3c743f41b4e74610953602a9d6a00b68411945
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/215332
Reviewed-by: Kayce Basques <[email protected]>
Commit-Queue: Asad Memon <[email protected]>
Lint: Lint 🤖 <[email protected]>
  • Loading branch information
asadm authored and CQ Bot Account committed Jun 13, 2024
1 parent 7578677 commit c07f0fa
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions pw_docgen/py/pw_docgen/sphinx/inlinesearch/js/searchbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ document.addEventListener('DOMContentLoaded', () => {

results = window.fuzzysort.go(query, index, { key: 'title' });
searchResults.innerHTML = '';
searchResults.style.display = 'block';
searchResults.style.display = 'grid';

if (results.length === 0) {
searchResults.innerHTML = '<li><a href="#">No results found</a></li>';
Expand All @@ -80,10 +80,7 @@ document.addEventListener('DOMContentLoaded', () => {
searchResults.style.width =
Math.max(
searchField.offsetWidth,
Array.from(searchResults.children).reduce(
(max, child) => Math.max(max, child.offsetWidth),
0,
) + 20,
searchResults.querySelector('li').offsetWidth,
) + 'px';
}

Expand Down

0 comments on commit c07f0fa

Please sign in to comment.